[Vladimir Eltsov <ve@boojum.hut.fi>] bug with -fcaller-saves
Dave Love
d.love@dl.ac.uk
Thu Jan 29 10:20:00 GMT 1998
This appears to be a (non-critical?) backend problem reported as a g77
bug. I can reproduce it, but (only) with -O[2]. Any ideas other than
`don't do that, then'? :-)
------- Start of forwarded message -------
Date: Tue, 27 Jan 1998 19:25:19 +0200 (EET)
From: Vladimir Eltsov <ve@boojum.hut.fi>
To: fortran@gnu.org
Subject: bug with -fcaller-saves
Message-ID: <Pine.LNX.3.96.980127190257.1606A-100000@slon.hut.fi>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Hello!
Following program would hang after printing 6 lines when compiled with
'g77 -O2 test.f' on x86 architecture, but would work OK when compiled with
'g77 -O2 -fno-caller-saves test.f' both for gnu and egcs variants of the
compiler.
Details follow:
------- test.f -------
program test
implicit double precision (a-h,o-z)
t = 0
tend = 1
dt = 6d-7
h = 0.314d-7
k = 1
ti = dt
do while (t.lt.tend)
do while(t.lt.ti)
if (t+h.gt.ti) then
h = ti-t
end if
call fun(t,h)
end do
print *,k,t,t/5d-7
k = k+1
ti = k*dt
end do
end
subroutine fun(t,h)
implicit double precision (a-h,o-z)
t = t+h
h = 0.314d-7
return
end
------- correct output -------
1 6.E-07 1.2
2 1.2E-06 2.4
3 1.8E-06 3.6
4 2.4E-06 4.8
5 3.E-06 6.
6 3.6E-06 7.2
7 4.2E-06 8.4
8 4.8E-06 9.6
9 5.4E-06 10.8
10 6.E-06 12.
11 6.6E-06 13.2
12 7.2E-06 14.4
13 7.8E-06 15.6
14 8.4E-06 16.8
15 9.E-06 18.
16 9.6E-06 19.2
17 1.02E-05 20.4
18 1.08E-05 21.6
19 1.14E-05 22.8
20 1.2E-05 24.
21 1.26E-05 25.2
22 1.32E-05 26.4
.... and a lot more lines ....
------- incorrect behaviour ----------
1 6.E-07 1.2
2 1.2E-06 2.4
3 1.8E-06 3.6
4 2.4E-06 4.8
5 3.E-06 6.
6 3.6E-06 7.2
... hang here ...
-----------------------------------
> uname -a
Linux slon.hut.fi 2.0.32 #1 Wed Nov 19 00:46:45 EST 1997 i686 unknown
> cat /proc/cpuinfo
processor : 0
cpu : 686
model : 3
vendor_id : GenuineIntel
stepping : 3
fdiv_bug : no
hlt_bug : no
f00f_bug : no
fpu : yes
fpu_exception : yes
cpuid : yes
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 11 mtrr pge mca cmov
mmx
bogomips : 267.06
> ldd ./a.out
libm.so.6 => /lib/libm.so.6 (0x40003000)
libc.so.6 => /lib/libc.so.6 (0x4001c000)
/lib/ld-linux.so.2 => /lib/ld-linux.so.2 (0x00000000)
> g77 -v
g77 version 0.5.21
gcc -v -fnull-version -o /tmp/gfa01630 -xf77-cpp-input /tmp/gfa01630.f
-xnone -lf2c -lm
Reading specs from /usr/lib/gcc-lib/i686-unknown-linux/2.7.2.3.f.1/specs
gcc version 2.7.2.3.f.1
/usr/lib/gcc-lib/i686-unknown-linux/2.7.2.3.f.1/cpp -lang-c -v -undef
-D__GNUC__=2 -D__GNUC_MINOR__=7 -D__ELF__ -D__unix__ -D__i386__
-D__linux__ -D__unix -D__i386 -D__linux -Asystem(unix) -Asystem(posix)
-Acpu(i386) -Amachine(i386) -D_LANGUAGE_FORTRAN -traditional
/tmp/gfa01630.f /tmp/cca01631.i
GNU CPP version 2.7.2.3.f.1 (i386 Linux/ELF)
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/usr/i686-unknown-linux/include
/usr/lib/gcc-lib/i686-unknown-linux/2.7.2.3.f.1/include
/usr/include
End of search list.
/usr/lib/gcc-lib/i686-unknown-linux/2.7.2.3.f.1/f771 /tmp/cca01631.i
-fset-g77-defaults -m486 -quiet -dumpbase gfa01630.F -version -fversion
-fnull-version -o /tmp/cca01631.s
GNU F77 version 2.7.2.3.f.1 (i386 Linux/ELF) compiled by GNU C version
2.7.2.3.f.1.
GNU Fortran Front End version 0.5.21 compiled: Dec 14 1997 15:23:12
as -V -Qy -o /tmp/cca016311.o /tmp/cca01631.s
GNU assembler version 2.8.1 (i686-pc-linux-gnu), using BFD version
linux-2.8.1.0.1
ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o /tmp/gfa01630
/usr/lib/crt1.o /usr/lib/crti.o
/usr/lib/gcc-lib/i686-unknown-linux/2.7.2.3.f.1/crtbegin.o
-L/usr/lib/gcc-lib/i686-unknown-linux/2.7.2.3.f.1 /tmp/cca016311.o -lf2c
-lm -lgcc -lc -lgcc
/usr/lib/gcc-lib/i686-unknown-linux/2.7.2.3.f.1/crtend.o /usr/lib/crtn.o
__G77_LIBF77_VERSION__: 0.5.21
@(#)LIBF77 VERSION 19970404
__G77_LIBI77_VERSION__: 0.5.21
@(#) LIBI77 VERSION pjw,dmg-mods 19970816
__G77_LIBU77_VERSION__: 0.5.21
@(#) LIBU77 VERSION 19970609
> gcc -v
Reading specs from /usr/lib/gcc-lib/i686-unknown-linux/2.7.2.3.f.1/specs
gcc version 2.7.2.3.f.1
> /usr/local/bin/g77 -v
Reading specs from
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.90.23/specs
gcc version egcs-2.90.23 980102 (egcs-1.0.1 release)
> /usr/local/bin/gcc -v
Reading specs from
/usr/local/lib/gcc-lib/i686-pc-linux-gnu/egcs-2.90.23/specs
gcc version egcs-2.90.23 980102 (egcs-1.0.1 release)
----------------------------
Sincerely yours,
Vladimir Eltsov
------- End of forwarded message -------
More information about the Gcc-bugs
mailing list