public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [committed] Fix OpenMP ICE on invalid during gimplification (PR c/47963)
@ 2011-03-03 16:14 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2011-03-03 16:14 UTC (permalink / raw)
  To: gcc-patches

Hi!

omp_notice_variable isn't prepared to see INTEGER_CST (which wouldn't be
there on valid code where DECL_SIZE is a DECL).
Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux,
committed to trunk.

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.

--- gcc/gimplify.c.jj	2010-12-09 11:12:48.000000000 +0100
+++ gcc/gimplify.c	2011-03-03 09:18:01.000000000 +0100
@@ -5511,7 +5511,8 @@ omp_add_variable (struct gimplify_omp_ct
 	 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))
--- gcc/testsuite/gcc.dg/gomp/pr47963.c.jj	2011-03-03 10:13:56.000000000 +0100
+++ gcc/testsuite/gcc.dg/gomp/pr47963.c	2011-03-03 09:22:41.000000000 +0100
@@ -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)
+  ;
+}
--- gcc/testsuite/g++.dg/gomp/pr47963.C.jj	2011-03-03 10:13:22.000000000 +0100
+++ gcc/testsuite/g++.dg/gomp/pr47963.C	2011-03-03 10:13:39.000000000 +0100
@@ -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)
+  ;
+}

	Jakub

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-03-03 16:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-03-03 16:14 [committed] Fix OpenMP ICE on invalid during gimplification (PR c/47963) Jakub Jelinek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).