[committed] Add testcase for already fixed PR c++/84556

Message ID 20180226102148.GP5867@tucnak
State New
Headers show
Series
  • [committed] Add testcase for already fixed PR c++/84556
Related show

Commit Message

Jakub Jelinek Feb. 26, 2018, 10:21 a.m.
Hi!

This ICE got fixed already in r257820, but more testsuite coverage doesn't
hurt.

2018-02-26  Jakub Jelinek  <jakub@redhat.com>

	PR c++/84556
	* g++.dg/gomp/pr84556.C: New test.
	* g++.dg/vect/pr84556.cc: New test.


	Jakub

Patch

--- gcc/testsuite/g++.dg/gomp/pr84556.C.jj	2018-02-26 11:13:36.848451757 +0100
+++ gcc/testsuite/g++.dg/gomp/pr84556.C	2018-02-26 11:13:20.463451315 +0100
@@ -0,0 +1,14 @@ 
+// PR c++/84556
+// { dg-do compile }
+// { dg-options "-std=c++17 -fopenmp-simd" }
+
+void
+foo ()
+{
+  auto x = [] ()
+  {
+    #pragma omp simd
+    for (int i = 0; i < 8; ++i)
+      ;
+  };
+}
--- gcc/testsuite/g++.dg/vect/pr84556.cc.jj	2018-02-26 11:12:01.488449209 +0100
+++ gcc/testsuite/g++.dg/vect/pr84556.cc	2018-02-26 11:10:59.744447561 +0100
@@ -0,0 +1,21 @@ 
+// PR c++/84556
+// { dg-do run { target c++11 } }
+// { dg-options "-O2 -fopenmp-simd" }
+// { dg-additional-options "-mavx" { target avx_runtime } }
+
+int
+main ()
+{
+  int y[8] = { 1, 2, 3, 4, 5, 6, 7, 8 };
+  auto x = [&y] ()
+  {
+    #pragma omp simd
+    for (int i = 0; i < 8; ++i)
+      y[i]++;
+  };
+  x ();
+  x ();
+  for (int i = 0; i < 8; ++i)
+    if (y[i] != i + 3)
+      __builtin_abort ();
+}