This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/70198] simple test floating point sequence gives incorrect values-- optimizer changes them
- From: "kargl at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 12 Mar 2016 00:10:51 +0000
- Subject: [Bug fortran/70198] simple test floating point sequence gives incorrect values-- optimizer changes them
- Auto-submitted: auto-generated
- References: <bug-70198-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70198
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|WAITING |RESOLVED
Resolution|--- |INVALID
--- Comment #5 from kargl at gcc dot gnu.org ---
If the code is compiled with the -fno-automatic option,
one generates the desired result. Note I said desired,
not correct, because the code has a significant bug.
When m=2 (see comment #4), the computed goto jumps to
label 4. The do-loop with the label 6 is executed.
The variable 'a' is undefined. It appears that this
subroutine needs a SAVE statement.
subroutine runge(n,y,f,x,h,m,k)
C This routine performs Runge-Kutta calculation by Gills Method
C
dimension y(10),f(10),q(10)
m=m+1
go to (1,4,5,3,7), m
1 do 2 i=1,n
2 q(i)=0
a=.5
go to 9
3 a=1.7071067811865475244
4 x=x+.5*h
5 do 6 i=1,n
y(i)=y(i)+a*(f(i)*h-q(i))
6 q(i)=2.*a*h*f(i)+(1.-3.*a)*q(i)
a=.2928932188134524756
go to 9
7 do 8 i=1,n
8 y(i)=y(i)+h*f(i)/6.-q(i)/3.
m=0
k=2
go to 10
9 k=1
10 return
end