Fix libgomp Fortran tests

Steve Kargl sgk@troutmask.apl.washington.edu
Fri Sep 8 20:25:00 GMT 2006


On Fri, Sep 08, 2006 at 03:03:15AM -0400, Jakub Jelinek wrote:
> On Thu, Sep 07, 2006 at 04:53:54PM -0700, Steve Kargl wrote:
> > The attached patch fixes 2 problems in the libgomp testsuite.
> > The Fortran tried to use the most negative integer value, but
> > this cause an overflow because gfortran creates this value 
> > via a unary minus operation.
> 
> > --- libgomp/testsuite/libgomp.fortran/reduction4.f90	(revision 116723)
> > +++ libgomp/testsuite/libgomp.fortran/reduction4.f90	(working copy)
> > @@ -12,7 +12,7 @@
> >    ka = Z'05a5a5'
> >    v = .false.
> >    cnt = -1
> > -  x = Z'ffffffff'
> > +  x = - huge(x) - 1
> 
> This can't be right.  The test really needs an integer with all bits set,
> -huge(x) - 1 is Z'80000000'.  That's what the OpenMP standard mandates
> that iand reduction var should be initialized to.
> 

Here's a new patch.  It uses not(0).  As I said elsewhere the
gfortran frontend uses GMP for the integer constant 0, and the
simplification routine for not() will actually do what you 
want.  My patch that exposed this problem, fixes not() to
use an appropriate mask.

 
	* libgomp/testsuite/libgomp.fortran/reduction3.f90: Change
	-2147483648 to -huge(i)-1 to avoid overflow.
	* libgomp/testsuite/libgomp.fortran/reduction4.f90: Change
	Z'ffffffff' to not(0) to avoid overflow.

OK?

-- 
Steve
-------------- next part --------------
Index: libgomp/testsuite/libgomp.fortran/reduction3.f90
===================================================================
--- libgomp/testsuite/libgomp.fortran/reduction3.f90	(revision 116723)
+++ libgomp/testsuite/libgomp.fortran/reduction3.f90	(working copy)
@@ -17,7 +17,7 @@
 
 !$omp parallel num_threads (3) private (n) reduction (.or.:v) &
 !$omp & reduction (max:i, ia, r, ra, d, da)
-!$ if (i .ne. -2147483648 .or. any (ia .ne. -2147483648)) v = .true.
+!$ if (i .ne. -huge(i)-1 .or. any (ia .ne. -huge(ia)-1)) v = .true.
 !$ if (r .ge. -1.0d38 .or. any (ra .ge. -1.0d38)) v = .true.
 !$ if (d .ge. -1.0d300 .or. any (da .ge. -1.0d300)) v = .true.
   n = omp_get_thread_num ()
Index: libgomp/testsuite/libgomp.fortran/reduction4.f90
===================================================================
--- libgomp/testsuite/libgomp.fortran/reduction4.f90	(revision 116723)
+++ libgomp/testsuite/libgomp.fortran/reduction4.f90	(working copy)
@@ -12,7 +12,7 @@
   ka = Z'05a5a5'
   v = .false.
   cnt = -1
-  x = Z'ffffffff'
+  x = not(0)
 
 !$omp parallel num_threads (3) private (n) reduction (.or.:v) &
 !$omp & reduction (iand:i, ia) reduction (ior:j, ja) reduction (ieor:k, ka)


More information about the Fortran mailing list