This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
g77 bug with ENTRY statement
- To: gcc-bugs at egcs dot cygnus dot com
- Subject: g77 bug with ENTRY statement
- From: "Steven G. Kargl" <kargl at troutmask dot apl dot washington dot edu>
- Date: Mon, 16 Aug 1999 08:37:48 -0700 (PDT)
Code exhibiting the bug:
subroutine a(x,y,z)
real x,y,z
integer i
z=x+y
return
entry b(i)
i=int(z)
return
end
program main
real z
integer i
call a(1.,2.,z)
write(*,*) z
call b(i)
write(*,*) i
stop
end
troutmask:kargl[246] f77 -v -o a a.f
g77 version egcs-2.91.66 19990314 (egcs-1.1.2 release) (from FSF-g77 version 0.5.24-19981002)
Driving: f77 -v -o a a.f -lg2c -lm
Using builtin specs.
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
/usr/libexec/f771 a.f -quiet -dumpbase a.f -version -fversion -o /var/tmp/ccx20727.s
GNU F77 version egcs-2.91.66 19990314 (egcs-1.1.2 release) (i386-unknown-freebsd) compiled by GNU C version egcs-2.91.66 19990314 (egcs-1.1.2 release).
GNU Fortran Front End version 0.5.24-19981002
/usr/libexec/elf/as -v -o /var/tmp/cct20727.o /var/tmp/ccx20727.s
GNU assembler version 2.9.1 (i386-unknown-freebsdelf), using BFD version 2.9.1
/usr/libexec/elf/ld -m elf_i386 -dynamic-linker /usr/libexec/ld-elf.so.1 -o a /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/libdata/gcc -L/usr/libexec/elf -L/usr/libexec /var/tmp/cct20727.o -lg2c -lm /usr/lib/libgcc.a -lc /usr/lib/libgcc.a /usr/lib/crtend.o /usr/lib/crtn.o
troutmask:kargl[247] a
3.
Segmentation fault (core dumped)
The problem:
subroutine a(x,y,z)
real x,y,z ! z is a dummy argument to a()
integer i
z=x+y
return
entry b(i)
i=int(z) ! z is no longer in scope.
return
end
Purposed fix:
g77 should issue a warning that z is a dummy argument in
subroutine a() and that it is undefined at entry b().
--
Steve