This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/35946] New: wrong result with array constructor as argument to ATAN2
- From: "dick dot hendrickson at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Apr 2008 15:27:04 -0000
- Subject: [Bug fortran/35946] New: wrong result with array constructor as argument to ATAN2
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
The following program gives the wrong answers when an array
constructor with a "complicated" implied do is used as an
argument to REAL which is then used as an argument to
ATAN2.
Dick Hendrickson
program try_fa6013
! fails on Windows XP
! gcc version 4.4.0 20080312 (experimental) [trunk revision 133139]
call fa6013(10,1,-1)
end program
subroutine FA6013 (nf10,nf1,mf1)
integer, parameter :: kv=4 !fails
! integer, parameter :: kv=8 !fails
REAL(KV) DDA1(10)
REAL(KV) DDA2(10)
REAL(KV) DDA(10), dval
dda = (/ 1,2,3,4,5,6,7,8,9,10/)
print '(10f5.1)', REAL((/(J1,J1=nf10,nf1,mf1)/),KV) !works
DDA1 = ATAN2 ( (/(REAL(J1,KV),J1=1,10)/) ,
$ REAL((/(J1,J1=nf10,nf1,mf1)/),KV)) !fails
! $ REAL((/(J1,J1= 10, 1, -1)/),KV)) !works
DDA2 = ATAN2 ( DDA, DDA(10:1:-1) )
DVAL = .09967_kv !atan2(1.0,10.0)
print '(i3,3f10.5)', 1, dda1(1),dval, dval-dda1(1)
DO J1 = 2,10
DVAL = DDA2(J1)
print '(i3,3f10.5)', j1, dda1(j1),dval, dval-dda1(j1)
100 ENDDO
END
c:\gfortran:gfortran fa6013.f
c:\gfortran:a
10.0 9.0 8.0 7.0 6.0 5.0 4.0 3.0 2.0 1.0
1 0.11066 0.09967 -0.01099
2 0.24498 0.21867 -0.02631
3 0.40489 0.35877 -0.04612
4 0.58800 0.51915 -0.06886
5 0.78540 0.69474 -0.09066
6 0.98279 0.87606 -0.10674
7 1.16590 1.05165 -0.11425
8 1.32582 1.21203 -0.11379
9 1.46014 1.35213 -0.10801
10 0.00000 1.47113 1.47113
--
Summary: wrong result with array constructor as argument to ATAN2
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dick dot hendrickson at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35946