This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/38955] New: testsuite/gfortran.dg/array_constructor_24.f fails due to floating point comparison
- From: "billingd at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Jan 2009 02:25:16 -0000
- Subject: [Bug fortran/38955] New: testsuite/gfortran.dg/array_constructor_24.f fails due to floating point comparison
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
With recent trunk (4.4.0 20090107), test gfortran.dg/array_constructor_24.f
fails on i686-pc-cygwin for the four -O3 execution tests. The failure is in
subroutine FA6013.
program try_fa6013
call fa6013 (10, 1, -1)
call fa6077 (10, 1, -1, (/1,2,3,4,5,6,7,8,9,10/))
call fa2083
end program
subroutine FA6013 (nf10, nf1, mf1)
integer, parameter :: kv = 4
REAL(KV) DDA1(10)
REAL(KV) DDA2(10)
REAL(KV) DDA(10), dval
dda = (/1,2,3,4,5,6,7,8,9,10/)
DDA1 = ATAN2 ((/(REAL(J1,KV),J1=1,10)/),
$ REAL((/(J1,J1=nf10,nf1,mf1)/), KV)) !fails
DDA2 = ATAN2 (DDA, DDA(10:1:-1))
if (any (abs(DDA1-DDA2) .gt. 1.0e-6)) call abort ()
END
On investigation, I found that all the components of arrays DDA1 and DDA2 were
equal, but the test "(any (DDA1 .ne. DDA2))" fails. It looks like a typical
ix86 excess precision problem when comparing floating point number for
equality.
The following patch allows the test to pass.
--- array_constructor_24.f.orig 2009-01-24 13:14:35.828125000 +1100
+++ array_constructor_24.f 2009-01-24 12:43:50.203125000 +1100
@@ -19,7 +19,7 @@
DDA1 = ATAN2 ((/(REAL(J1,KV),J1=1,10)/),
$ REAL((/(J1,J1=nf10,nf1,mf1)/), KV)) !fails
DDA2 = ATAN2 (DDA, DDA(10:1:-1))
- if (any (DDA1 .ne. DDA2)) call abort ()
+ if (any (abs(DDA1-DDA2) .gt. 1.0e-6)) call abort ()
END
subroutine FA6077 (nf10,nf1,mf1, ida)
--
Summary: testsuite/gfortran.dg/array_constructor_24.f fails due
to floating point comparison
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: billingd at gcc dot gnu dot org
GCC build triplet: i686-pc-cygwin
GCC host triplet: i686-pc-cygwin
GCC target triplet: i686-pc-cygwin
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38955