This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/70198] simple test floating point sequence gives incorrect values-- optimizer changes them


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]