This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gomp4] fix atomic tests


These two tests presumed a particular ordering of atomicc operation execution, which is kind of anethema to why you'd want atomic ops and parallelizing loops. I've removed the more obviously incorrect assumptions, but I have a suspicion the fortran one at least still contains undefined behaviour.

nathan
2016-01-22  Nathan Sidwell  <nathan@codesourcery.com>

	* testsuite/libgomp.oacc-c-c++-common/atomic_capture-1.c: Don't
	assume atomic op ordering.
	* testsuite/libgomp.oacc-fortran/atomic_capture-1.f90: Likewise.

Index: libgomp/testsuite/libgomp.oacc-c-c++-common/atomic_capture-1.c
===================================================================
--- libgomp/testsuite/libgomp.oacc-c-c++-common/atomic_capture-1.c	(revision 232738)
+++ libgomp/testsuite/libgomp.oacc-c-c++-common/atomic_capture-1.c	(working copy)
@@ -783,31 +783,6 @@ main(int argc, char **argv)
   fgot = 1.0;
   fexp = 0.0;
 
-#pragma acc data copy (fgot, fdata[0:N])
-  {
-#pragma acc parallel loop
-    for (i = 0; i < N; i++)
-      {
-        float expr = 32.0;
-
-#pragma acc atomic capture
-        fdata[i] = fgot = expr - fgot;
-      }
-  }
-
-  for (i = 0; i < N; i++)
-    if (i % 2 == 0)
-      {
-	if (fdata[i] != 31.0)
-	  abort ();
-      }
-    else
-      {
-	if (fdata[i] != 1.0)
-	  abort ();
-      }
-
-
   /* BINOP = / */
   fexp = 1.0;
   fgot = 8192.0*8192.0*64.0;
Index: libgomp/testsuite/libgomp.oacc-fortran/atomic_capture-1.f90
===================================================================
--- libgomp/testsuite/libgomp.oacc-fortran/atomic_capture-1.f90	(revision 232738)
+++ libgomp/testsuite/libgomp.oacc-fortran/atomic_capture-1.f90	(working copy)
@@ -257,7 +257,6 @@ program main
     end do
   !$acc end parallel loop
 
-  if (itmp /= iexp - 1) call abort
   if (igot /= iexp) call abort
 
   igot = N
@@ -272,7 +271,6 @@ program main
     end do
   !$acc end parallel loop
 
-  if (itmp /= iexp) call abort
   if (igot /= iexp) call abort
 
   igot = -1
@@ -288,7 +286,6 @@ program main
     end do
   !$acc end parallel loop
 
-  if (itmp /= ibset (iexp, N - 1)) call abort
   if (igot /= iexp) call abort
 
   igot = 0
@@ -304,7 +301,6 @@ program main
     end do
   !$acc end parallel loop
 
-  if (itmp /= ieor (iexp, lshift (1, N - 1))) call abort
   if (igot /= iexp) call abort
 
   igot = -1
@@ -320,7 +316,6 @@ program main
     end do
   !$acc end parallel loop
 
-  if (itmp /= ior (iexp, lshift (1, N - 1))) call abort
   if (igot /= iexp) call abort
 
   igot = 1
@@ -335,7 +330,6 @@ program main
     end do
   !$acc end parallel loop
 
-  if (itmp /= iexp - 1) call abort
   if (igot /= iexp) call abort
 
   igot = N
@@ -350,7 +344,6 @@ program main
     end do
   !$acc end parallel loop
 
-  if (itmp /= iexp) call abort
   if (igot /= iexp) call abort
 
   igot = -1
@@ -366,7 +359,6 @@ program main
     end do
   !$acc end parallel loop
 
-  if (itmp /= ibset (iexp, N - 1)) call abort
   if (igot /= iexp) call abort
 
   igot = 0
@@ -382,7 +374,6 @@ program main
     end do
   !$acc end parallel loop
 
-  if (itmp /= ieor (iexp, lshift (1, N - 1))) call abort
   if (igot /= iexp) call abort
 
   igot = -1
@@ -398,7 +389,6 @@ program main
     end do
   !$acc end parallel loop
 
-  if (itmp /= ior (iexp, lshift (1, N - 1))) call abort
   if (igot /= iexp) call abort
 
   fgot = 1234.0
@@ -525,7 +515,6 @@ program main
     end do
   !$acc end parallel loop
 
-  if (ftmp /= fexp) call abort
   if (fgot /= fexp) call abort
 
   fgot = 1.0

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]