The following valid code snippet triggers an ICE on mainline when compiled with "-fopenmp": ======================================== void foo() { #pragma omp parallel { struct A; } } ======================================== bug.c: In function 'foo': bug.c:3: internal compiler error: in replace_by_duplicate_decl, at tree-cfg.c:5412 Please submit a full bug report, [etc.] The bug appeared between 2008-06-21 and 2008-07-05.
Confirmed.
Happens with both the C and C++ front-ends. Backtrace: #2 0x00566f2e in replace_by_duplicate_decl (tp=0xbffff43c, vars_map=0x43902ae0, to_context=0x42f76100) at /Users/apinski/src/local/gcc/gcc/tree-cfg.c:5412 #3 0x00568ab2 in replace_block_vars_by_duplicates (block=0x42f79a40, vars_map=0x43902ae0, to_context=0x42f76100) at /Users/apinski/src/local/gcc/gcc/tree-cfg.c:5838 #4 0x00568d27 in replace_block_vars_by_duplicates (block=0x42f79a40, vars_map=0x43902ae0, to_context=0x42f76100) at /Users/apinski/src/local/gcc/gcc/tree-cfg.c:5852 #5 0x0056985d in move_sese_region_to_fn (dest_cfun=0x42ed0d20, entry_bb=0x42f79f80, exit_bb=0x42f79e40, orig_block=0x42f79a80) at /Users/apinski/src/local/gcc/gcc/tree-cfg.c:6019 #6 0x0040361f in expand_omp_taskreg (region=0x439010c0) at /Users/apinski/src/local/gcc/gcc/omp-low.c:3404 #7 0x0040d207 in expand_omp (region=0x439010c0) at /Users/apinski/src/local/gcc/gcc/omp-low.c:5201 #8 0x0040d720 in execute_expand_omp () at /Users/apinski/src/local/gcc/gcc/omp-low.c:5373 #9 0x0043a827 in execute_one_pass (pass=0xd0afc0) at /Users/apinski/src/local/gcc/gcc/passes.c:1279 --- CUT --- (gdb) p debug_tree (t) <type_decl 0x42f75380 D.1571 type <record_type 0x42f75310 A VOID align 8 symtab 0 alias set -1 canonical type 0x42f75310 context <block 0x42f79a40> chain <type_decl 0x42f75380 D.1571>> VOID file t.cc line 5 col 12 align 1 context <function_decl 0x42f76080 foo>> --- CUT --- I think we should ignore TYPE_DECLs if it is not a variable length based type.
Subject: Bug 38633 Author: jakub Date: Sat Dec 27 15:38:22 2008 New Revision: 142934 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=142934 Log: PR middle-end/38633 * tree-cfg.c (replace_block_vars_by_duplicates): Only call replace_by_duplicate_decl for VAR_DECLs or CONST_DECLs. * gcc.dg/gomp/pr38633.c: New test. * g++.dg/gomp/pr38633.C: New test. Added: trunk/gcc/testsuite/g++.dg/gomp/pr38633.C trunk/gcc/testsuite/gcc.dg/gomp/pr38633.c Modified: trunk/gcc/ChangeLog trunk/gcc/testsuite/ChangeLog trunk/gcc/tree-cfg.c
Fixed.