Bug 38633 - [4.4 regression] ICE with #pragma omp parallel and struct declaration
Summary: [4.4 regression] ICE with #pragma omp parallel and struct declaration
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: middle-end (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: 4.4.0
Assignee: Jakub Jelinek
URL:
Keywords: ice-on-valid-code, monitored, openmp
Depends on:
Blocks:
 
Reported: 2008-12-26 21:52 UTC by Volker Reichelt
Modified: 2008-12-27 15:41 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.3.3 4.3.2
Known to fail: 4.4.0
Last reconfirmed: 2008-12-27 10:42:20


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2008-12-26 21:52:05 UTC
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.
Comment 1 Andrew Pinski 2008-12-26 22:26:12 UTC
Confirmed.
Comment 2 Andrew Pinski 2008-12-26 22:29:07 UTC
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.
Comment 3 Jakub Jelinek 2008-12-27 15:39:45 UTC
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

Comment 4 Jakub Jelinek 2008-12-27 15:41:38 UTC
Fixed.