re PR middle-end/38633 (ICE with #pragma omp parallel and struct declaration)

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.

From-SVN: r142934
This commit is contained in:
Jakub Jelinek 2008-12-27 16:38:22 +01:00 committed by Jakub Jelinek
parent 749db154bd
commit e1e2bac4bd
5 changed files with 40 additions and 0 deletions

View file

@ -1,3 +1,9 @@
2008-12-27 Jakub Jelinek <jakub@redhat.com>
PR middle-end/38633
* tree-cfg.c (replace_block_vars_by_duplicates): Only call
replace_by_duplicate_decl for VAR_DECLs or CONST_DECLs.
2008-12-24 Kazu Hirata <kazu@codesourcery.com>
* Makefile.in (GTFILES): Add $(srcdir)/expr.h.

View file

@ -1,5 +1,9 @@
2008-12-27 Jakub Jelinek <jakub@redhat.com>
PR middle-end/38633
* gcc.dg/gomp/pr38633.c: New test.
* g++.dg/gomp/pr38633.C: New test.
PR c++/38639
* g++.dg/gomp/pr38639.C: New test.

View file

@ -0,0 +1,14 @@
// PR middle-end/38633
// { dg-do compile }
// { dg-options "-fopenmp" }
void
foo ()
{
#pragma omp parallel
{
struct A { int i; } j;
j.i = 6;
j.i++;
}
}

View file

@ -0,0 +1,14 @@
/* PR middle-end/38633 */
/* { dg-do compile } */
/* { dg-options "-fopenmp" } */
void
foo ()
{
#pragma omp parallel
{
struct A { int i; } j;
j.i = 6;
j.i++;
}
}

View file

@ -5835,6 +5835,8 @@ replace_block_vars_by_duplicates (tree block, struct pointer_map_t *vars_map,
for (tp = &BLOCK_VARS (block); *tp; tp = &TREE_CHAIN (*tp))
{
t = *tp;
if (TREE_CODE (t) != VAR_DECL && TREE_CODE (t) != CONST_DECL)
continue;
replace_by_duplicate_decl (&t, vars_map, to_context);
if (t != *tp)
{