From: Jakub Jelinek Date: Thu, 7 Apr 2011 18:27:20 +0000 (+0200) Subject: backport: re PR c/47963 (ICE: tree check: expected tree that contains 'decl common... X-Git-Tag: releases/gcc-4.5.3~92 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8732fce0b589de70cc04fd50f4af0d4f08a95357;p=thirdparty%2Fgcc.git backport: re PR c/47963 (ICE: tree check: expected tree that contains 'decl common' structure, have 'integer_cst' in is_global_var, at tree-flow-inline.h:599 on invalid code with -fopenmp) Backported from mainline 2011-03-03 Jakub Jelinek PR c/47963 * gimplify.c (omp_add_variable): Only call omp_notice_variable on TYPE_SIZE_UNIT if it is a DECL. * gcc.dg/gomp/pr47963.c: New test. * g++.dg/gomp/pr47963.C: New test. From-SVN: r172115 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8ebce09925b2..5fe612b12971 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,6 +1,12 @@ 2011-04-07 Jakub Jelinek Backported from mainline + 2011-03-03 Jakub Jelinek + + PR c/47963 + * gimplify.c (omp_add_variable): Only call omp_notice_variable + on TYPE_SIZE_UNIT if it is a DECL. + 2011-02-19 Jakub Jelinek PR c/47809 diff --git a/gcc/gimplify.c b/gcc/gimplify.c index d85c033063cd..7578418d33ca 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -5438,7 +5438,8 @@ omp_add_variable (struct gimplify_omp_ctx *ctx, tree decl, unsigned int flags) For local variables TYPE_SIZE_UNIT might not be gimplified yet, in this case omp_notice_variable will be called later on when it is gimplified. */ - else if (! (flags & GOVD_LOCAL)) + else if (! (flags & GOVD_LOCAL) + && DECL_P (TYPE_SIZE_UNIT (TREE_TYPE (decl)))) omp_notice_variable (ctx, TYPE_SIZE_UNIT (TREE_TYPE (decl)), true); } else if (lang_hooks.decls.omp_privatize_by_reference (decl)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 7a09f9f627c2..a924b4356b3e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,6 +1,12 @@ 2011-04-07 Jakub Jelinek Backported from mainline + 2011-03-03 Jakub Jelinek + + PR c/47963 + * gcc.dg/gomp/pr47963.c: New test. + * g++.dg/gomp/pr47963.C: New test. + 2011-02-19 Jakub Jelinek PR c/47809 diff --git a/gcc/testsuite/g++.dg/gomp/pr47963.C b/gcc/testsuite/g++.dg/gomp/pr47963.C new file mode 100644 index 000000000000..7c94e6422a71 --- /dev/null +++ b/gcc/testsuite/g++.dg/gomp/pr47963.C @@ -0,0 +1,11 @@ +// PR c/47963 +// { dg-do compile } +// { dg-options "-fopenmp" } + +void +foo (float n) +{ + int A[n][n]; // { dg-error "has non-integral type" } +#pragma omp parallel private(A) + ; +} diff --git a/gcc/testsuite/gcc.dg/gomp/pr47963.c b/gcc/testsuite/gcc.dg/gomp/pr47963.c new file mode 100644 index 000000000000..636a9542c323 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/pr47963.c @@ -0,0 +1,11 @@ +/* PR c/47963 */ +/* { dg-do compile } */ +/* { dg-options "-fopenmp" } */ + +void +foo (float n) +{ + int A[n][n]; /* { dg-error "has non-integer type" } */ +#pragma omp parallel private(A) + ; +}