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

--- Comment #6 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> 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.

Same problem with the array q. The code gives the "desired"
result with the following patch

--- pr70198.f   2016-03-11 22:10:39.000000000 +0100
+++ pr70198_db_1.f      2016-03-12 10:26:36.000000000 +0100
@@ -164,6 +164,7 @@ C
 C  This routine performs Runge-Kutta calculation by Gills Method
 C
       dimension y(10),f(10),q(10)
+      save a, q
       m=m+1
       go to (1,4,5,3,7), m
     1 do 2 i=1,n

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