public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix OpenMP ICE on incomplete type in shared clause (PR middle-end/35818)
@ 2008-04-03 18:57 Jakub Jelinek
  0 siblings, 0 replies; only message in thread
From: Jakub Jelinek @ 2008-04-03 18:57 UTC (permalink / raw)
  To: gcc-patches

Hi!

is_variable_size assumes the argument has complete type, which is ensured in
all clauses but OMP_CLAUSE_SHARED.

2008-04-03  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/35818
	* omp-low.c (scan_sharing_clauses) <case OMP_CLAUSE_SHARED>: Don't
	call is_variable_sized if decl has incomplete type.

	* gcc.dg/gomp/pr35818.c: New test.

--- gcc/omp-low.c.jj	2008-04-03 18:17:20.000000000 +0200
+++ gcc/omp-low.c	2008-04-03 18:38:42.000000000 +0200
@@ -993,7 +993,8 @@ scan_sharing_clauses (tree clauses, omp_
 	case OMP_CLAUSE_SHARED:
 	  gcc_assert (is_parallel_ctx (ctx));
 	  decl = OMP_CLAUSE_DECL (c);
-	  gcc_assert (!is_variable_sized (decl));
+	  gcc_assert (!COMPLETE_TYPE_P (TREE_TYPE (decl))
+		      || !is_variable_sized (decl));
 	  by_ref = use_pointer_for_field (decl, ctx);
 	  /* Global variables don't need to be copied,
 	     the receiver side will use them directly.  */
--- gcc/testsuite/gcc.dg/gomp/pr35818.c.jj	2008-04-03 19:02:42.000000000 +0200
+++ gcc/testsuite/gcc.dg/gomp/pr35818.c	2008-04-03 19:01:56.000000000 +0200
@@ -0,0 +1,16 @@
+/* PR middle-end/35818 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp" } */
+
+extern int a[];
+
+void
+foo (void)
+{
+#pragma omp parallel
+#pragma omp master
+  a[3] = 1;
+#pragma omp parallel shared(a)
+#pragma omp master
+  a[3] = 1;
+}

	Jakub

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

only message in thread, other threads:[~2008-04-03 18:55 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-04-03 18:57 [PATCH] Fix OpenMP ICE on incomplete type in shared clause (PR middle-end/35818) 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).