This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
OpenMP do loop with MAXINT
- From: "Paul Keir" <pkeir at dcs dot gla dot ac dot uk>
- To: <fortran at gcc dot gnu dot org>
- Date: Mon, 18 May 2009 16:11:23 +0100
- Subject: OpenMP do loop with MAXINT
Hi all,
The following test program gives different results for the second of its
three do loops; relative to the first and third. Is this a bug?
I've used -fdump-tree-original, and it occurs to me that the use of <=
to test against a maximal integer may play a part. I run with one
($OMP_NUM_THREADS) thread, and my output follows the code.
Regards,
Paul
-------------------------------------------------------------
program main
integer, parameter :: ikind = 4 ! Also for 8
integer(kind=ikind) :: i, maxint, stride, is30or62
integer(kind=ikind) :: normalcount, ompcount1, ompcount2
is30or62 = ikind * 8 - 2
maxint = (2**is30or62)+(2**is30or62-1) ! A simpler maxint?
print *
write (unit=*, fmt=*) "bigint is", maxint
write (unit=*, fmt=*) "bigint+1 is", maxint + 1
normalcount = 0
do i = maxint-9, maxint
normalcount = normalcount + 1
end do
ompcount1 = 0
!$omp parallel do
do i = maxint-9, maxint
ompcount1 = ompcount1 + 1
end do
!$end omp parallel do
stride = 1
ompcount2 = 0
!$omp parallel do
do i = maxint-9, maxint,stride
ompcount2 = ompcount2 + 1
end do
!$end omp parallel do
print *
write (unit=*, fmt=*) "normalcount is ", normalcount
write (unit=*, fmt=*) "ompcount1 is ", ompcount1
write (unit=*, fmt=*) "ompcount2 is ", ompcount2
print *
end program
-------------------------------------------------------------
bigint is 2147483647
bigint+1 is -2147483648
normalcount is 10
ompcount1 is 1
ompcount2 is 10
-------------------------------------------------------------
Paul Keir
Research Student
University of Glasgow
Department of Computing Science
pkeir@dcs.gla.ac.uk