re PR middle-end/35818 (ICE on incomplete array in shared clause)
authorJakub Jelinek <jakub@redhat.com>
Thu, 3 Apr 2008 21:02:44 +0000 (23:02 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 3 Apr 2008 21:02:44 +0000 (23:02 +0200)
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.

From-SVN: r133875

gcc/ChangeLog
gcc/omp-low.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/gomp/pr35818.c [new file with mode: 0644]

index aec6128ea847c8ca1e0430b5fcf98330922d59fb..29a3cce9711d0519707c08ca6a9ff08b0411fa35 100644 (file)
@@ -1,3 +1,9 @@
+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.
+
 2008-04-03  H.J. Lu  <hongjiu.lu@intel.com>
 
        * config/i386/i386-protos.h (ix86_aligned_p): Removed.
index 45602c24d748b704e04404cae2f536c40c709213..ffdf447d32926e9db01716ed387c046878122814 100644 (file)
@@ -993,7 +993,8 @@ scan_sharing_clauses (tree clauses, omp_context *ctx)
        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.  */
index bd7e6e5815de566e3dd117623af5b4e4e7d9108b..1bad997c7fa9dac5ec177eee8db34faeae6095b2 100644 (file)
@@ -1,5 +1,8 @@
 2008-04-03  Jakub Jelinek  <jakub@redhat.com>
 
+       PR middle-end/35818
+       * gcc.dg/gomp/pr35818.c: New test.
+
        PR fortran/35786
        * gfortran.dg/gomp/pr35786-1.f90: New test.
        * gfortran.dg/gomp/pr35786-2.f90: New test.
diff --git a/gcc/testsuite/gcc.dg/gomp/pr35818.c b/gcc/testsuite/gcc.dg/gomp/pr35818.c
new file mode 100644 (file)
index 0000000..b2165eb
--- /dev/null
@@ -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;
+}