Bug 32118 - ICE in c++ code
Summary: ICE in c++ code
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Keywords: ice-on-valid-code
Depends on:
Reported: 2007-05-28 01:41 UTC by Bowie Owens
Modified: 2011-09-25 17:17 UTC (History)
3 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail: 4.1.2, 4.2.0, 4.3.0
Last reconfirmed: 2007-05-28 12:28:24

gzip'ed preprocessed source to reproduce ICE (165.58 KB, application/x-tar)
2007-05-28 01:42 UTC, Bowie Owens
reduced testcase (973 bytes, text/plain)
2007-05-28 12:23 UTC, Richard Biener

Note You need to log in before you can comment on or make changes to this bug.
Description Bowie Owens 2007-05-28 01:41:07 UTC
internal compiler error: Segmentation fault occurs in c++ code.

Built from gcc 4.2.0 release source.

g++ -v:
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.2.0/configure --prefix=/local_scratch/owe043/gcc_4_2 --enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.2.0

To reproduce ICE command is:

g++ foo.ii

Output of g++ is:

foo.cc:118: internal compiler error: Segmentation fault
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

Will attach foo.ii.
Comment 1 Bowie Owens 2007-05-28 01:42:14 UTC
Created attachment 13619 [details]
gzip'ed preprocessed source to reproduce ICE
Comment 2 Richard Biener 2007-05-28 10:29:59 UTC
Comment 3 Richard Biener 2007-05-28 12:23:50 UTC
Created attachment 13621 [details]
reduced testcase
Comment 4 Richard Biener 2007-05-28 12:28:24 UTC
Confirmed.  Another mangling problem:

Program received signal SIGSEGV, Segmentation fault.
0x0827e9b8 in write_expression (expr=0xb7cdd870)
    at /home/richard/src/trunk2/gcc/cp/mangle.c:2175
warning: Source file is more recent than executable.
2175          write_string (operator_name_info[(int) code].mangled_name);
(gdb) print operator_name_info[(int) code]
$1 = {identifier = 0x0, name = 0x0, mangled_name = 0x0, arity = 0}
(gdb) print code
$2 = 214

#2  0x08280a16 in write_template_arg (node=0xb7daf540)
    at /home/richard/src/trunk2/gcc/cp/mangle.c:2363
2363          write_expression (node);
(gdb) call debug_tree(node)
 <addr_expr 0xb7daf540
    arg 0 <template_id_expr 0xb7cdd870
        type <lang_type 0xb7d61d80 unknown type type <lang_type 0xb7d61d80 unknown type>
            align 1 symtab 0 alias set -1 canonical type 0xb7d61d80
            pointer_to_this <lang_type 0xb7d61d80 unknown type> reference_to_this <lang_type 0xb7d61d80 unknown type>>
        arg 0 <overload 0xb7db1a9c type <lang_type 0xb7d61d80 unknown type>
            function <template_decl 0xb7db3b64 direct_context_cast>>
        arg 1 <tree_vec 0xb7db632c
            elt 0 <template_type_parm 0xb7db5654 Iface>>>>
Comment 5 Paolo Carlini 2011-09-25 17:17:10 UTC
Fixed in 4.5.x.