diff mbox series

Backports to 7.x

Message ID 20170907204422.GW2323@tucnak
State New
Headers show
Series Backports to 7.x | expand

Commit Message

Jakub Jelinek Sept. 7, 2017, 8:44 p.m. UTC
Hi!

I've bootstrapped/regtested and committed to gcc-7-branch backports
of 10 trunk commits.

	Jakub
2017-09-07  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2017-07-27  Jakub Jelinek  <jakub@redhat.com>

	PR c/45784
	* c-omp.c (c_finish_omp_for): If the condition is wrapped in
	rhs of COMPOUND_EXPR(s), skip them and readd their lhs into
	new COMPOUND_EXPRs around the rhs of the comparison.

	* testsuite/libgomp.c/pr45784.c: New test.
	* testsuite/libgomp.c++/pr45784.C: New test.
2017-09-07  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2017-08-03  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/81052
	* omp-low.c (diagnose_sb_0): Handle flag_openmp_simd like flag_openmp.
	(pass_diagnose_omp_blocks::gate): Enable also for flag_openmp_simd.

	* c-c++-common/pr81052.c: New test.

--- gcc/omp-low.c	(revision 250846)
+++ gcc/omp-low.c	(revision 250847)
@@ -9083,7 +9083,7 @@ diagnose_sb_0 (gimple_stmt_iterator *gsi
     }
   if (kind == NULL)
     {
-      gcc_checking_assert (flag_openmp);
+      gcc_checking_assert (flag_openmp || flag_openmp_simd);
       kind = "OpenMP";
     }
 
@@ -9343,7 +9343,7 @@ public:
   /* opt_pass methods: */
   virtual bool gate (function *)
   {
-    return flag_cilkplus || flag_openacc || flag_openmp;
+    return flag_cilkplus || flag_openacc || flag_openmp || flag_openmp_simd;
   }
   virtual unsigned int execute (function *)
     {
--- gcc/testsuite/c-c++-common/pr81052.c	(nonexistent)
+++ gcc/testsuite/c-c++-common/pr81052.c	(revision 250847)
@@ -0,0 +1,28 @@
+/* PR middle-end/81052 */
+/* { dg-do compile } */
+/* { dg-options "-fopenmp-simd -O2" } */
+
+int
+foo (int x, int y)
+{
+  int i;
+#pragma omp simd
+  for (i = x; i < y; ++i)
+    return 0;			/* { dg-error "invalid branch to/from OpenMP structured block" } */
+  return 1;
+}
+
+#ifdef __cplusplus
+template <typename T>
+T
+bar (T x, T y)
+{
+  T i;
+#pragma omp simd
+  for (i = x; i < y; ++i)
+    return 0;			/* { dg-error "invalid branch to/from OpenMP structured block" "" { target c++ } } */
+  return 1;
+}
+
+int x = bar (1, 7);
+#endif
2017-09-07  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2017-08-03  Jakub Jelinek  <jakub@redhat.com>

	PR driver/81650
	* calls.c (alloc_max_size): Use HOST_WIDE_INT_UC (10??)
	instead of 10??LU, perform unit multiplication in wide_int,
	don't change alloc_object_size_limit if the limit is larger
	than SSIZE_MAX.

	* gcc.dg/pr81650.c: New test.

--- gcc/calls.c	(revision 250849)
+++ gcc/calls.c	(revision 250850)
@@ -1222,32 +1222,38 @@ alloc_max_size (void)
 		  else if (!strcasecmp (end, "KiB") || strcmp (end, "KB"))
 		    unit = 1024;
 		  else if (!strcmp (end, "MB"))
-		    unit = 1000LU * 1000;
+		    unit = HOST_WIDE_INT_UC (1000) * 1000;
 		  else if (!strcasecmp (end, "MiB"))
-		    unit = 1024LU * 1024;
+		    unit = HOST_WIDE_INT_UC (1024) * 1024;
 		  else if (!strcasecmp (end, "GB"))
-		    unit = 1000LU * 1000 * 1000;
+		    unit = HOST_WIDE_INT_UC (1000) * 1000 * 1000;
 		  else if (!strcasecmp (end, "GiB"))
-		    unit = 1024LU * 1024 * 1024;
+		    unit = HOST_WIDE_INT_UC (1024) * 1024 * 1024;
 		  else if (!strcasecmp (end, "TB"))
-		    unit = 1000LU * 1000 * 1000 * 1000;
+		    unit = HOST_WIDE_INT_UC (1000) * 1000 * 1000 * 1000;
 		  else if (!strcasecmp (end, "TiB"))
-		    unit = 1024LU * 1024 * 1024 * 1024;
+		    unit = HOST_WIDE_INT_UC (1024) * 1024 * 1024 * 1024;
 		  else if (!strcasecmp (end, "PB"))
-		    unit = 1000LU * 1000 * 1000 * 1000 * 1000;
+		    unit = HOST_WIDE_INT_UC (1000) * 1000 * 1000 * 1000 * 1000;
 		  else if (!strcasecmp (end, "PiB"))
-		    unit = 1024LU * 1024 * 1024 * 1024 * 1024;
+		    unit = HOST_WIDE_INT_UC (1024) * 1024 * 1024 * 1024 * 1024;
 		  else if (!strcasecmp (end, "EB"))
-		    unit = 1000LU * 1000 * 1000 * 1000 * 1000 * 1000;
+		    unit = HOST_WIDE_INT_UC (1000) * 1000 * 1000 * 1000 * 1000
+			   * 1000;
 		  else if (!strcasecmp (end, "EiB"))
-		    unit = 1024LU * 1024 * 1024 * 1024 * 1024 * 1024;
+		    unit = HOST_WIDE_INT_UC (1024) * 1024 * 1024 * 1024 * 1024
+			   * 1024;
 		  else
 		    unit = 0;
 		}
 
 	      if (unit)
-		alloc_object_size_limit
-		  = build_int_cst (ssizetype, limit * unit);
+		{
+		  wide_int w = wi::uhwi (limit, HOST_BITS_PER_WIDE_INT + 64);
+		  w *= unit;
+		  if (wi::ltu_p (w, alloc_object_size_limit))
+		    alloc_object_size_limit = wide_int_to_tree (ssizetype, w);
+		}
 	    }
 	}
     }
--- gcc/testsuite/gcc.dg/pr81650.c	(nonexistent)
+++ gcc/testsuite/gcc.dg/pr81650.c	(revision 250850)
@@ -0,0 +1,9 @@
+/* PR driver/81650 */
+/* { dg-do compile } */
+/* { dg-options "-Walloc-size-larger-than=9223372036854775807" } */
+
+void *
+foo (void)
+{
+  return __builtin_malloc (5);
+}
2017-09-07  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2017-08-03  Jakub Jelinek  <jakub@redhat.com>

	PR target/81621
	* bb-reorder.c (pass_partition_blocks::execute): Return TODO_df_finish
	after setting changeable df flags.

	* gcc.dg/pr81621.c: New test.

--- gcc/bb-reorder.c	(revision 250856)
+++ gcc/bb-reorder.c	(revision 250857)
@@ -2904,7 +2904,8 @@ pass_partition_blocks::execute (function
 
   crossing_edges = find_rarely_executed_basic_blocks_and_crossing_edges ();
   if (!crossing_edges.exists ())
-    return 0;
+    /* Make sure to process deferred rescans and clear changeable df flags.  */
+    return TODO_df_finish;
 
   crtl->has_bb_partition = true;
 
@@ -2970,7 +2971,8 @@ pass_partition_blocks::execute (function
       df_analyze ();
     }
 
-  return 0;
+  /* Make sure to process deferred rescans and clear changeable df flags.  */
+  return TODO_df_finish;
 }
 
 } // anon namespace
--- gcc/testsuite/gcc.dg/pr81621.c	(nonexistent)
+++ gcc/testsuite/gcc.dg/pr81621.c	(revision 250857)
@@ -0,0 +1,5 @@
+/* PR target/81621 */
+/* { dg-do compile { target freorder } } */
+/* { dg-options "-Og -fno-split-wide-types -freorder-blocks-and-partition" } */
+
+#include "graphite/scop-10.c"
2017-09-07  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2017-08-07  Jakub Jelinek  <jakub@redhat.com>

	* include/system/sys/ptrace.h: New file.

--- libsanitizer/include/system/sys/ptrace.h	(nonexistent)
+++ libsanitizer/include/system/sys/ptrace.h	(revision 250910)
@@ -0,0 +1,7 @@
+#include_next <sys/ptrace.h>
+#ifndef PTRACE_GETREGSET
+/* glibc before
+   https://sourceware.org/git/?p=glibc.git;a=commitdiff;h=cbff0d9689c4d68578b6a4f0a17807232506ea27
+   doesn't define PTRACE_GETREGSET.  */
+#define PTRACE_GETREGSET 0x4204
+#endif
2017-09-07  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2017-08-09  Jakub Jelinek  <jakub@redhat.com>

	PR c/81687
	* omp-low.c (omp_copy_decl): Don't remap FORCED_LABEL or DECL_NONLOCAL
	LABEL_DECLs.
	* tree-cfg.c (move_stmt_op): Don't adjust DECL_CONTEXT of FORCED_LABEL
	or DECL_NONLOCAL labels.
	(move_stmt_r) <case GIMPLE_LABEL>: Adjust DECL_CONTEXT of FORCED_LABEL
	or DECL_NONLOCAL labels here.

	* testsuite/libgomp.c/pr81687-1.c: New test.
	* testsuite/libgomp.c/pr81687-2.c: New test.

--- gcc/omp-low.c	(revision 251018)
+++ gcc/omp-low.c	(revision 251019)
@@ -798,6 +798,8 @@ omp_copy_decl (tree var, copy_body_data
 
   if (TREE_CODE (var) == LABEL_DECL)
     {
+      if (FORCED_LABEL (var) || DECL_NONLOCAL (var))
+	return var;
       new_var = create_artificial_label (DECL_SOURCE_LOCATION (var));
       DECL_CONTEXT (new_var) = current_function_decl;
       insert_decl_map (&ctx->cb, var, new_var);
--- gcc/tree-cfg.c	(revision 251018)
+++ gcc/tree-cfg.c	(revision 251019)
@@ -6718,7 +6718,15 @@ move_stmt_op (tree *tp, int *walk_subtre
 		*tp = t = out->to;
 	    }
 
-	  DECL_CONTEXT (t) = p->to_context;
+	  /* For FORCED_LABELs we can end up with references from other
+	     functions if some SESE regions are outlined.  It is UB to
+	     jump in between them, but they could be used just for printing
+	     addresses etc.  In that case, DECL_CONTEXT on the label should
+	     be the function containing the glabel stmt with that LABEL_DECL,
+	     rather than whatever function a reference to the label was seen
+	     last time.  */
+	  if (!FORCED_LABEL (t) && !DECL_NONLOCAL (t))
+	    DECL_CONTEXT (t) = p->to_context;
 	}
       else if (p->remap_decls_p)
 	{
@@ -6836,6 +6844,21 @@ move_stmt_r (gimple_stmt_iterator *gsi_p
     case GIMPLE_OMP_RETURN:
     case GIMPLE_OMP_CONTINUE:
       break;
+
+    case GIMPLE_LABEL:
+      {
+	/* For FORCED_LABEL, move_stmt_op doesn't adjust DECL_CONTEXT,
+	   so that such labels can be referenced from other regions.
+	   Make sure to update it when seeing a GIMPLE_LABEL though,
+	   that is the owner of the label.  */
+	walk_gimple_op (stmt, move_stmt_op, wi);
+	*handled_ops_p = true;
+	tree label = gimple_label_label (as_a <glabel *> (stmt));
+	if (FORCED_LABEL (label) || DECL_NONLOCAL (label))
+	  DECL_CONTEXT (label) = p->to_context;
+      }
+      break;
+
     default:
       if (is_gimple_omp (stmt))
 	{
--- libgomp/testsuite/libgomp.c/pr81687-1.c	(nonexistent)
+++ libgomp/testsuite/libgomp.c/pr81687-1.c	(revision 251019)
@@ -0,0 +1,23 @@
+/* PR c/81687 */
+/* { dg-do link } */
+/* { dg-additional-options "-O2" } */
+
+extern int printf (const char *, ...);
+
+int
+main ()
+{
+  #pragma omp parallel
+  {
+   lab1:
+    printf ("lab1=%p\n", (void *)(&&lab1));
+  }
+ lab2:
+  #pragma omp parallel
+  {
+   lab3:
+    printf ("lab2=%p\n", (void *)(&&lab2));
+  }
+  printf ("lab3=%p\n", (void *)(&&lab3));
+  return 0;
+}
--- libgomp/testsuite/libgomp.c/pr81687-2.c	(nonexistent)
+++ libgomp/testsuite/libgomp.c/pr81687-2.c	(revision 251019)
@@ -0,0 +1,27 @@
+/* PR c/81687 */
+/* { dg-do link } */
+/* { dg-additional-options "-O2" } */
+
+int
+main ()
+{
+  __label__ lab4, lab5, lab6;
+  volatile int l = 0;
+  int m = l;
+  void foo (int x) { if (x == 1) goto lab4; }
+  void bar (int x) { if (x == 2) goto lab5; }
+  void baz (int x) { if (x == 3) goto lab6; }
+  #pragma omp parallel
+  {
+    foo (m + 1);
+   lab4:;
+  }
+  #pragma omp task
+  {
+    bar (m + 2);
+   lab5:;
+  }
+  baz (m + 3);
+ lab6:;
+  return 0;
+}
2017-09-07  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2017-09-01  Jakub Jelinek  <jakub@redhat.com>

	PR sanitizer/81923
	* asan.c (create_odr_indicator): Strip name encoding from assembler
	name before appending it after __odr_asan_.

	* gcc.dg/asan/pr81923.c: New test.

--- gcc/asan.c	(revision 251594)
+++ gcc/asan.c	(revision 251595)
@@ -2527,9 +2527,12 @@ create_odr_indicator (tree decl, tree ty
   /* DECL_NAME theoretically might be NULL.  Bail out with 0 in this case.  */
   if (decl_name == NULL_TREE)
     return build_int_cst (uptr, 0);
-  size_t len = strlen (IDENTIFIER_POINTER (decl_name)) + sizeof ("__odr_asan_");
+  const char *dname = IDENTIFIER_POINTER (decl_name);
+  if (HAS_DECL_ASSEMBLER_NAME_P (decl))
+    dname = targetm.strip_name_encoding (dname);
+  size_t len = strlen (dname) + sizeof ("__odr_asan_");
   name = XALLOCAVEC (char, len);
-  snprintf (name, len, "__odr_asan_%s", IDENTIFIER_POINTER (decl_name));
+  snprintf (name, len, "__odr_asan_%s", dname);
 #ifndef NO_DOT_IN_LABEL
   name[sizeof ("__odr_asan") - 1] = '.';
 #elif !defined(NO_DOLLAR_IN_LABEL)
--- gcc/testsuite/gcc.dg/asan/pr81923.c	(nonexistent)
+++ gcc/testsuite/gcc.dg/asan/pr81923.c	(revision 251595)
@@ -0,0 +1,10 @@
+/* PR sanitizer/81923 */
+/* { dg-do link } */
+
+int foobar __asm (__USER_LABEL_PREFIX__ "barbaz") = 34;
+
+int
+main ()
+{
+  return 0;
+}
2017-09-07  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2017-09-04  Jakub Jelinek  <jakub@redhat.com>

	* lra-remat.c (reg_overlap_for_remat_p): Fix a pasto.

--- gcc/lra-remat.c	(revision 251638)
+++ gcc/lra-remat.c	(revision 251639)
@@ -684,7 +684,7 @@ reg_overlap_for_remat_p (lra_insn_reg *r
 
 	if (regno2 >= FIRST_PSEUDO_REGISTER && reg_renumber[regno2] >= 0)
 	  regno2 = reg_renumber[regno2];
-	if (regno >= FIRST_PSEUDO_REGISTER)
+	if (regno2 >= FIRST_PSEUDO_REGISTER)
 	  nregs2 = 1;
 	else
 	  nregs2 = hard_regno_nregs[regno2][reg->biggest_mode];
2017-09-07  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2017-09-05  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/81768
	* omp-expand.c (expand_omp_simd): Force second operands of COND_EXPR
	into gimple val before gimplification fo the COND_EXPR.

	* gcc.dg/gomp/pr81768-1.c: New test.

--- gcc/omp-expand.c	(revision 251740)
+++ gcc/omp-expand.c	(revision 251741)
@@ -4730,24 +4730,28 @@ expand_omp_simd (struct omp_region *regi
 	      tree itype2 = TREE_TYPE (fd->loops[i - 1].v);
 	      if (POINTER_TYPE_P (itype2))
 		itype2 = signed_type_for (itype2);
+	      t = fold_convert (itype2, fd->loops[i - 1].step);
+	      t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE, true,
+					    GSI_SAME_STMT);
 	      t = build3 (COND_EXPR, itype2,
 			  build2 (fd->loops[i].cond_code, boolean_type_node,
 				  fd->loops[i].v,
 				  fold_convert (itype, fd->loops[i].n2)),
-			  build_int_cst (itype2, 0),
-			  fold_convert (itype2, fd->loops[i - 1].step));
+			  build_int_cst (itype2, 0), t);
 	      if (POINTER_TYPE_P (TREE_TYPE (fd->loops[i - 1].v)))
 		t = fold_build_pointer_plus (fd->loops[i - 1].v, t);
 	      else
 		t = fold_build2 (PLUS_EXPR, itype2, fd->loops[i - 1].v, t);
 	      expand_omp_build_assign (&gsi, fd->loops[i - 1].v, t);
 
+	      t = fold_convert (itype, fd->loops[i].n1);
+	      t = force_gimple_operand_gsi (&gsi, t, true, NULL_TREE, true,
+					    GSI_SAME_STMT);
 	      t = build3 (COND_EXPR, itype,
 			  build2 (fd->loops[i].cond_code, boolean_type_node,
 				  fd->loops[i].v,
 				  fold_convert (itype, fd->loops[i].n2)),
-			  fd->loops[i].v,
-			  fold_convert (itype, fd->loops[i].n1));
+			  fd->loops[i].v, t);
 	      expand_omp_build_assign (&gsi, fd->loops[i].v, t);
 	    }
 	}
--- gcc/testsuite/gcc.dg/gomp/pr81768-1.c	(nonexistent)
+++ gcc/testsuite/gcc.dg/gomp/pr81768-1.c	(revision 251741)
@@ -0,0 +1,15 @@
+/* PR middle-end/81768 */
+/* { dg-do compile } */
+
+float b[10][15][10];
+
+void
+foo (void)
+{
+  float *i;
+#pragma omp target parallel for simd schedule(static, 32) collapse(3)
+  for (i = &b[0][0][0]; i < &b[0][0][10]; i++)
+    for (float *j = &b[0][15][0]; j > &b[0][0][0]; j -= 10)
+      for (float *k = &b[0][0][10]; k > &b[0][0][0]; --k)
+	b[i - &b[0][0][0]][(j - &b[0][0][0]) / 10 - 1][(k - &b[0][0][0]) - 1] -= 3.5;
+}
2017-09-07  Jakub Jelinek  <jakub@redhat.com>

	Backported from mainline
	2017-09-05  Jakub Jelinek  <jakub@redhat.com>

	PR middle-end/81768
	* omp-low.c (lower_omp_for): Recompute tree invariant if
	gimple_omp_for_initial/final is ADDR_EXPR.

	* gcc.dg/gomp/pr81768-2.c: New test.

--- gcc/omp-low.c	(revision 251741)
+++ gcc/omp-low.c	(revision 251742)
@@ -6923,10 +6923,14 @@ lower_omp_for (gimple_stmt_iterator *gsi
       rhs_p = gimple_omp_for_initial_ptr (stmt, i);
       if (!is_gimple_min_invariant (*rhs_p))
 	*rhs_p = get_formal_tmp_var (*rhs_p, &body);
+      else if (TREE_CODE (*rhs_p) == ADDR_EXPR)
+	recompute_tree_invariant_for_addr_expr (*rhs_p);
 
       rhs_p = gimple_omp_for_final_ptr (stmt, i);
       if (!is_gimple_min_invariant (*rhs_p))
 	*rhs_p = get_formal_tmp_var (*rhs_p, &body);
+      else if (TREE_CODE (*rhs_p) == ADDR_EXPR)
+	recompute_tree_invariant_for_addr_expr (*rhs_p);
 
       rhs_p = &TREE_OPERAND (gimple_omp_for_incr (stmt, i), 1);
       if (!is_gimple_min_invariant (*rhs_p))
--- gcc/testsuite/gcc.dg/gomp/pr81768-2.c	(nonexistent)
+++ gcc/testsuite/gcc.dg/gomp/pr81768-2.c	(revision 251742)
@@ -0,0 +1,15 @@
+/* PR middle-end/81768 */
+/* { dg-do compile } */
+
+float b[10][15][10];
+
+void
+foo (void)
+{
+  float *i;
+#pragma omp target parallel for schedule(static, 32) collapse(3)
+  for (i = &b[0][0][0]; i < &b[0][0][10]; i++)
+    for (float *j = &b[0][15][0]; j > &b[0][0][0]; j -= 10)
+      for (float *k = &b[0][0][10]; k > &b[0][0][0]; --k)
+        b[i - &b[0][0][0]][(j - &b[0][0][0]) / 10 - 1][(k - &b[0][0][0]) - 1] -= 3.5;
+}
diff mbox series

Patch

--- gcc/c-family/c-omp.c	(revision 250634)
+++ gcc/c-family/c-omp.c	(revision 250635)
@@ -531,6 +531,12 @@  c_finish_omp_for (location_t locus, enum
 	{
 	  bool cond_ok = false;
 
+	  /* E.g. C sizeof (vla) could add COMPOUND_EXPRs with
+	     evaluation of the vla VAR_DECL.  We need to readd
+	     them to the non-decl operand.  See PR45784.  */
+	  while (TREE_CODE (cond) == COMPOUND_EXPR)
+	    cond = TREE_OPERAND (cond, 1);
+
 	  if (EXPR_HAS_LOCATION (cond))
 	    elocus = EXPR_LOCATION (cond);
 
@@ -605,6 +611,21 @@  c_finish_omp_for (location_t locus, enum
 		  else if (code != CILK_SIMD && code != CILK_FOR)
 		    cond_ok = false;
 		}
+
+	      if (cond_ok && TREE_VEC_ELT (condv, i) != cond)
+		{
+		  tree ce = NULL_TREE, *pce = &ce;
+		  tree type = TREE_TYPE (TREE_OPERAND (cond, 1));
+		  for (tree c = TREE_VEC_ELT (condv, i); c != cond;
+		       c = TREE_OPERAND (c, 1))
+		    {
+		      *pce = build2 (COMPOUND_EXPR, type, TREE_OPERAND (c, 0),
+				     TREE_OPERAND (cond, 1));
+		      pce = &TREE_OPERAND (*pce, 1);
+		    }
+		  TREE_OPERAND (cond, 1) = ce;
+		  TREE_VEC_ELT (condv, i) = cond;
+		}
 	    }
 
 	  if (!cond_ok)
--- libgomp/testsuite/libgomp.c/pr45784.c	(nonexistent)
+++ libgomp/testsuite/libgomp.c/pr45784.c	(revision 250635)
@@ -0,0 +1,41 @@ 
+/* PR c/45784 */
+/* { dg-do run } */
+
+void
+foo (int n)
+{
+  char *p, vla[2 * n];
+  int i;
+  #pragma omp parallel for
+  for (p = vla; p < vla + (sizeof (vla) / sizeof (vla[0])); p++)
+    *p = ' ';
+  #pragma omp parallel for
+  for (i = 0; i < 2 * n; i++)
+    if (vla[i] != ' ')
+      __builtin_abort ();
+}
+
+void
+bar (int n)
+{
+  char *p, vla1[n], vla2[n * 2], vla3[n * 3], vla4[n * 4];
+  int i;
+  __builtin_memset (vla4, ' ', n * 4);
+  #pragma omp parallel for
+  for (p = vla4 + sizeof (vla1); p < vla4 + sizeof (vla3) - sizeof (vla2) + sizeof (vla1); p += sizeof (vla4) / sizeof (vla4))
+    p[0] = '!';
+  #pragma omp parallel for
+  for (i = 0; i < n * 4; i++)
+    if (vla4[i] != ((i >= n && i < 2 * n) ? '!' : ' '))
+      __builtin_abort ();
+}
+
+int
+main ()
+{
+  volatile int n;
+  n = 128;
+  foo (n);
+  bar (n);
+  return 0;
+}
--- libgomp/testsuite/libgomp.c++/pr45784.C	(nonexistent)
+++ libgomp/testsuite/libgomp.c++/pr45784.C	(revision 250635)
@@ -0,0 +1,5 @@ 
+// PR c/45784
+// { dg-do run }
+
+#include "../libgomp.c/pr45784.c"
+