Development

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • New: Multiple-inheritance code triggers "internal compiler error: in build_base_path, at c

    10 answers - 3105 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    Compiling a .cpp file with the following contents triggers an internal compiler
    error:
    <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    struct Base {
    template<class Cvoid method() { }
    };
    struct Left : public Base { };
    struct Right : public Base { };
    struct Join : public Left, public Right { };
    void function()
    {
    Join join;
    join.Base::method<int>();
    join.Left::method<int>();
    }
    Issued command-line:
    g++ -Wall -W -Wundef -Wpointer-arith -g -c -o /dev/null bug.cpp
    Resulting output:
    bug.cpp: In function 'void function()':
    bug.cpp:13: internal compiler error: in build_base_path, at cp/class.c:273
    Please submit a full bug report,
    The error does not occur if structs Left and Right inherit virtually from Base;
    that is, "struct Left : virtual public Base { };" and similarly for Right.
    The same error occurs with gcc-3.4.3, the only difference being that the
    relevant line number in cp/class.cp is 275.
    Full output from running with "-v " is as follows:
    g++ -v -save-temps -Wall -W -Wundef -Wpointer-arith -g -c -o /dev/null
    bug.cpp
    Using built-in specs.
    Target: i686-pc-linux-gnu
    Configured with: /gcc-4.1.1/configure
    ,c++
    Thread model: posix
    gcc version 4.1.1
    / -E -quiet -v
    -D_GNU_SURCE bug.cpp -mtune=pentiumpro -Wall -W -Wundef -Wpointer-arith
    -fworking-directory -fpch-preprocess -o bug.ii
    ignoring nonexistent directory "NNE/include"
    ignoring nonexistent directory
    "/"
    #include "" search starts here:
    #include <search starts here:
    /
    /
    /
    /usr/local/include
    /
    /usr/include
    End of search list.
    / -fpreprocessed bug.ii
    -quiet -dumpbase bug.cpp -mtune=pentiumpro -auxbase-strip /dev/null -g
    -Wall -W -Wundef -Wpointer-arith -version -o bug.s
    GNU C++ version 4.1.1 (i686-pc-linux-gnu)
    compiled by GNU C version 4.1.1.
    GGC heuristics: ggc-min-expand=63 ggc-min-heapsize=63424
    Compiler executable checksum:
    bug.cpp: In function 'void function()':
    bug.cpp:13: internal compiler error: in build_base_path, at cp/class.c:273
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <for instructions.
    Contents of bug.ii:
    <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    # 1 "bug.cpp"
    # 1 "/home/raymond/tmp//"
    # 1 "<built-in>"
    # 1 "<command line>"
    # 1 "bug.cpp"
    struct Base {
    template<class Cvoid method() { }
    };
    struct Left : public Base { };
    struct Right : public Base { };
    struct Join : public Left, public Right { };
    void function()
    {
    Join join;
    join.Base::method<int>();
    join.Left::method<int>();
    }
  • No.1 | | 342 bytes | |

    Comment #1 from pinskia at gcc dot gnu dot org 2006-09-14 15:33
    This is invalid code, 3.3.3 and before gave the following error:
    t.cc: In function `void function()':
    t.cc:13: error: `Base' is an ambiguous base of `Join'
    Which is correct.

    Also we don't get an ICE if we try with a non template function.
  • No.2 | | 405 bytes | |

    Comment #2 from raymond at corvil dot com 2006-09-14 15:58
    Line 13 in the sample code is invalid code but line 14 is valid (Base is an
    unambiguous base class of Left). Deleting line 13 leaves code that compiles
    cleanly with gcc-3.3.5 (i386-portbld-freebsd4.8, gcc version 3.3.5 20040901
    (prerelease) [FreeBSD]).

    Apologies for any confusion, I meant to delete line 13 before submitting.
  • No.3 | | 677 bytes | |

    Comment #3 from bangerth at dealii dot org 2006-09-15 13:49
    Confirmed. This is the valid testcase:

    struct Base {
    template<class Cvoid method() { }
    };

    struct Left : public Base { };
    struct Right : public Base { };
    struct Join : public Left, public Right { };

    void function()
    {
    Join join;
    join.Left::method<int>();
    }

    and this is what we get from 4.1 branch:

    g/x/ -c x.cc
    x.cc: In function 'void function()':
    x.cc:12: internal compiler error: in build_base_path, at cp/class.c:273
    Please submit a full bug report,
    with preprocessed source if appropriate.
    See <for instructions.
  • No.4 | | 122 bytes | |

    --
    mmitchel at gcc dot gnu dot org changed:
    What |Removed |Added
    Priority|P3 |P1
  • No.5 | | 3192 bytes | |

    Comment #4 from steven at gcc dot gnu dot org 2006-09-23 15:19
    Breakpoint 1, fancy_abort (file=0xde98b0 "//trunk/gcc/cp/class.c",
    line=272,
    function=0xde98a0 "build_base_path") at
    642 internal_error ("in %s, at %s:%d", function, trim_filename (file),
    line);
    (gdb) up
    #1 0x00000000004c328a in build_base_path (code=PLUS_EXPR, expr=0x2aaaaaf85340,
    binfo=0x2aaaaaac19a0, nonnull=1) at //trunk/gcc/cp/class.c:269
    269 gcc_assert ((code == MINUS_EXPR
    (gdb) l
    264
    265 probe = TYPE_MAIN_VARIANT (TREE_TYPE (expr));
    266 if (want_pointer)
    267 probe = TYPE_MAIN_VARIANT (TREE_TYPE (probe));
    268
    269 gcc_assert ((code == MINUS_EXPR
    270 && SAME_BINFTYPE_P (BINFTYPE (binfo), probe))
    271 || (code == PLUS_EXPR
    272 && SAME_BINFTYPE_P (BINFTYPE (d_binfo), probe)));
    273
    (gdb) p code
    $1 = PLUS_EXPR
    (gdb)
    (gdb) p probe
    $2 = (tree) 0x2aaaaaf7db00
    (gdb) p debug_tree(probe)
    <record_type 0x2aaaaaf7db00 Join type_1 type_5 HI
    size <integer_cst 0x2aaaaadf09c0 type <integer_type 0x2aaaaae030b0
    bit_size_typeconstant invariant 16>
    unit size <integer_cst 0x2aaaaadf09f0 type <integer_type 0x2aaaaae03000
    long unsigned intconstant invariant 2>
    align 8 symtab 0 alias set -1
    fields <type_decl 0x2aaaaaf87000 Join type <record_type 0x2aaaaaf7db00
    Join>
    nonlocal decl_4 VID file t.C line 7
    align 1 context <record_type 0x2aaaaaf7db00 Join>
    >

    X() X(constX&) this=(X&) n_parents=2 use_template=0 interface-unknown
    pointer_to_this <pointer_type 0x2aaaaaf7ddc0chain <type_decl
    0x2aaaaaf20dd0 Join>>
    $3 = void
    (gdb) p debug_tree(d_binfo)
    <tree_binfo 0x2aaaaaac1930
    type <record_type 0x2aaaaaf7d840 Left type_1 type_5 QI
    size <integer_cst 0x2aaaaadf07b0 constant invariant 8>
    unit size <integer_cst 0x2aaaaadf07e0 constant invariant 1>
    align 8 symtab 0 alias set -1
    fields <type_decl 0x2aaaaaf20d00 Left type <record_type 0x2aaaaaf7d840
    Left>
    nonlocal decl_4 VID file t.C line 5
    align 1 context <record_type 0x2aaaaaf7d840 Left>
    >

    X() X(constX&) this=(X&) n_parents=1 use_template=0 interface-unknown
    chain <type_decl 0x2aaaaaf20c30 Left>>
    private>
    $4 = void
    (gdb) p d_binfo->common.type
    $5 = (tree) 0x2aaaaaf7d840
    (gdb) p debug_tree(d_binfo->common.type)
    <record_type 0x2aaaaaf7d840 Left type_1 type_5 QI
    size <integer_cst 0x2aaaaadf07b0 type <integer_type 0x2aaaaae030b0
    bit_size_typeconstant invariant 8>
    unit size <integer_cst 0x2aaaaadf07e0 type <integer_type 0x2aaaaae03000
    long unsigned intconstant invariant 1>
    align 8 symtab 0 alias set -1
    fields <type_decl 0x2aaaaaf20d00 Left type <record_type 0x2aaaaaf7d840
    Left>
    nonlocal decl_4 VID file t.C line 5
    align 1 context <record_type 0x2aaaaaf7d840 Left>
    >

    X() X(constX&) this=(X&) n_parents=1 use_template=0 interface-unknown
    chain <type_decl 0x2aaaaaf20c30 Left>>
    $6 = void
    (gdb)
  • No.6 | | 213 bytes | |

    --
    mmitchel at gcc dot gnu dot org changed:
    What |Removed |Added
    AssignedTo|unassigned at gcc dot gnu |mark at codesourcery dot com
    |dot org |
    Status|NEW |ASSIGNED
  • No.7 | | 465 bytes | |

    Comment #5 from mmitchel at gcc dot gnu dot org 2006-10-02 04:12
    Subject: Bug 29080

    Author: mmitchel
    Date: Mon 2 04:12:30 2006
    New Revision: 117360

    URL:
    Log:
    PR c++/29080
    * parser.c (): Use
    BASELINK_ACCESS_BINF as the qualifying scope when calling

    PR c++/29080
    * gdg/template/member7.C: New test.

    Added:

    Modified:
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/testsuite/ChangeLog
  • No.8 | | 378 bytes | |

    Comment #6 from mmitchel at gcc dot gnu dot org 2006-10-02 04:51
    Subject: Bug 29080

    Author: mmitchel
    Date: Mon 2 04:51:28 2006
    New Revision: 117363

    URL:
    Log:
    PR c++/29080
    * parser.c (): Use
    BASELINK_ACCESS_BINF as the qualifying scope when calling

    PR c++/29080
    * gdg/template/member7.C: New test.

    Added:

    Modified:
  • No.9 | | 561 bytes | |

    --

    mmitchel at gcc dot gnu dot org changed:

    What |Removed |Added

    AssignedTo|mark at codesourcery dot com|unassigned at gcc dot gnu
    | |dot org
    Status|ASSIGNED |NEW
    Summary|[4.0/4.1 Regression] |[4.0 Regression] Multiple-
    |Multiple-inheritance with |inheritance with template
    |template method function |method function code
    |code triggers "internal |triggers "internal compiler
    |compiler error: in |error: in build_base_path,
    |build_base_path, at |at cp/class.c:273"
    |cp/class.c:273" |

  • No.10 | | 83 bytes | |

    Comment #7 from gdr at gcc dot gnu dot org 2007-02-03 20:15
    Fixed in GCC-4.1.2.

Re: New: Multiple-inheritance code triggers "internal compiler error: in build_base_path, at c


max 4000 letters.
Your nickname that display:
In order to stop the spam: 7 + 6 =
QUESTION ON "Development"

EMSDN.COM