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: "dominiq at lps dot ens.fr" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 12 Mar 2016 09:32:11 +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
--- 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