]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR c/47963 (ICE: tree check: expected tree that contains 'decl common...
authorJakub Jelinek <jakub@redhat.com>
Thu, 7 Apr 2011 18:27:20 +0000 (20:27 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 7 Apr 2011 18:27:20 +0000 (20:27 +0200)
Backported from mainline
2011-03-03  Jakub Jelinek  <jakub@redhat.com>

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

gcc/ChangeLog
gcc/gimplify.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/gomp/pr47963.C [new file with mode: 0644]
gcc/testsuite/gcc.dg/gomp/pr47963.c [new file with mode: 0644]

index 8ebce09925b224b6366f3b1403d2edae64cf6b72..5fe612b12971ebc0312613115b43e61fb5f2da44 100644 (file)
@@ -1,6 +1,12 @@
 2011-04-07  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2011-03-03  Jakub Jelinek  <jakub@redhat.com>
+
+       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  <jakub@redhat.com>
 
        PR c/47809
index d85c033063cdb66b99a1a4197547a23f1e4fe5dd..7578418d33ca59c322b904805ee40ac48b49aad5 100644 (file)
@@ -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))
index 7a09f9f627c28a147b2392118342f56a46c6a04a..a924b4356b3e3d734592c85f1fb24a4de2369f94 100644 (file)
@@ -1,6 +1,12 @@
 2011-04-07  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2011-03-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR c/47963
+       * gcc.dg/gomp/pr47963.c: New test.
+       * g++.dg/gomp/pr47963.C: New test.
+
        2011-02-19  Jakub Jelinek  <jakub@redhat.com>
 
        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 (file)
index 0000000..7c94e64
--- /dev/null
@@ -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 (file)
index 0000000..636a954
--- /dev/null
@@ -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)
+  ;
+}