@@ -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))
@@ -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)
+ ;
+}
@@ -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)
+ ;
+}