Hi!

These tests had a thinko, computation performed on the offloaded copy of the
a variable, but then tested on the host side, without #pragma omp target
update or similar.
Fixed thusly.

I'm still seeing
FAIL: libgomp.c/for-5.c (internal compiler error)
FAIL: libgomp.c/for-5.c (test for excess errors)
FAIL: libgomp.c++/for-13.C (internal compiler error)
FAIL: libgomp.c++/for-13.C (test for excess errors)
which is some LTO ICE.

2015-07-17  Jakub Jelinek  <ja...@redhat.com>

        * testsuite/libgomp.c/linear-2.c (verify): New function.
        (TEST): Use it.
        * testsuite/libgomp.c++/linear-2.C (verify): New function.
        (TEST): Use it.

--- libgomp/testsuite/libgomp.c/linear-2.c.jj   2015-06-18 15:16:18.000000000 
+0200
+++ libgomp/testsuite/libgomp.c/linear-2.c      2015-07-17 15:23:45.000000000 
+0200
@@ -200,17 +200,28 @@ f18 (long long int i, long long int k, s
     }
 }
 
+void
+verify (void)
+{
+  int err;
+  #pragma omp target map(from:err)
+  {
+    err = 0;
+    for (int i = 0; i < 256; i++)
+      if (a[i] != (((i & 3) == 0 && i >= 8
+                   && i < 8 + 48 * 4)
+                  ? ((i - 8) / 4) + 16 : 0))
+       err = 1;
+    __builtin_memset (a, 0, sizeof (a));
+  }
+  if (err)
+    __builtin_abort ();
+}
+
 int
 main ()
 {
-#define TEST(x) \
-  x;                                           \
-  for (int i = 0; i < 256; i++)                        \
-    if (a[i] != (((i & 3) == 0 && i >= 8       \
-                 && i < 8 + 48 * 4)            \
-                ? ((i - 8) / 4) + 16 : 0))     \
-      __builtin_abort ();                      \
-  __builtin_memset (a, 0, sizeof (a))
+#define TEST(x) x; verify ()
   TEST (f1 (8));
   TEST (f2 (8, 3));
   TEST (f3 (8LL, 4LL));
--- libgomp/testsuite/libgomp.c++/linear-2.C.jj 2015-06-18 15:16:18.000000000 
+0200
+++ libgomp/testsuite/libgomp.c++/linear-2.C    2015-07-17 15:26:20.190269857 
+0200
@@ -204,17 +204,28 @@ f18 (long long int i, long long int k, s
     }
 }
 
+void
+verify (void)
+{
+  int err;
+  #pragma omp target map(from:err)
+  {
+    err = 0;
+    for (int i = 0; i < 256; i++)
+      if (a[i] != (((i & 3) == 0 && i >= 8
+                   && i < 8 + 48 * 4)
+                  ? ((i - 8) / 4) + 16 : 0))
+       err = 1;
+    __builtin_memset (a, 0, sizeof (a));
+  }
+  if (err)
+    __builtin_abort ();
+}
+
 int
 main ()
 {
-#define TEST(x) \
-  x;                                           \
-  for (int i = 0; i < 256; i++)                        \
-    if (a[i] != (((i & 3) == 0 && i >= 8       \
-                 && i < 8 + 48 * 4)            \
-                ? ((i - 8) / 4) + 16 : 0))     \
-      __builtin_abort ();                      \
-  __builtin_memset (a, 0, sizeof (a))
+#define TEST(x) x; verify ()
   int vi = 8;
   TEST (f1 (vi));
   TEST (f2 (8, 3));

        Jakub

Reply via email to