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]

Re: bug report for g77 (F77 fortran compiler)


AFAIK g77 is not intended to provide full support for the "f66"
standard, which was the only version of the Fortran standard to
support "extended range of a DO"  cf ISO 1539-1980(E) p. A-2
paragraph (7).  Yes, the diagnostic level and support for the
undesirable (and now, for 10 years, officially obsolescent)
assigned go to is weak.

----- Original Message -----
From: "Jerzy Tarasiuk" <jt@japc50.fuw.edu.pl>
To: <gcc-bugs@gcc.gnu.org>
Cc: <jt@fuw.edu.pl>
Sent: Tuesday, May 09, 2000 10:25 AM
Subject: bug report for g77 (F77 fortran compiler)


> Hello, here is a program which shows the bug.
>
> The compiler version: egcs-g77.1.1.2 (details on end).
>
> Problem: DO has hidden variable which causes it to behave
> differently from Fortran standard - terminate the DO loop
> prematurely if another loop was executed during the time;
> the variable keeps remaing count of loop repeats;
> this occurs when jump is done outside the loop range and
> then back into the loop (such a construction is allowed
> by the standard). Also, the compiler shows warning or
> error (depends on order of instructions) when such a jump
> is used (the warning is not shown if it is assigned goto).
>
> The program worked OK with every other compiler I seen.
>
> Jerzy Tarasiuk  <jt@fuw.edu.pl>
>
> ----------------------------------------------------------
>
> program dotest
>
> C**** DOTEST - show a bug of 'DO' in Linux F77 compiler.
> C
> C Jerzy Tarasiuk 09 May 2000
> C
> k=0
> l=5
> i=-1
> C without the following ASSIGN result is the same,
> C but the compiler issues warning in spite it is valid
> C in FORTRAN to jump outside DO loop and back jump into it.
> assign 4 to j
> do 4 i=1,l
> C the following WRITE is executed 2 times, the DO loop ends
> C in spite the value of L is 5 - this is the _BUG_ of F77!
> write(*,1004) 'l',i,k,l
> goto 41
>  4 continue
> write(*,1004) 'e',i,k,l
> stop
> C can put here instructions change value of K only, the K=1
> C is used twice to make final value of K independent of I
> C but the result does not depend on the change.
>  41 if(i.eq.1) goto j
> C for first pass of DO 4 the IF condition is met and return
> C to DO 4 loop is done in the line above; for next pass the
> C condition is missed and the DO loop below is executed;
> C the only result of the loop should be changing of K which
> C is irrelevant, but it has also hidden side effect which
> C causes the bug: internal loop counter is set to -1, and
> C the DO 4 loop is terminated on begin of next pass.
> do 42 k=1,i
>  42 continue
> goto j
>  1004 format(1x,a1,3h i=,i2,3h k=,i2,3h l=,i2)
> end
>
> ------------------------------------------------------------
>
> $ g77 --verbose
>
> g77 version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
(from FSF-g77 version 0.5.24-19981002)
> Driving: g77 -v -c -xf77-version /dev/null -xnone
> Reading specs from
/usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/specs
> gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
>

/usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/cpp -lang-c -
v -undef -D__GNUC__=2 -D__GNUC_MINOR__=91 -D__ELF__ -D__unix__ -
D__i386__ -D__i386__ -D__linux__ -D__unix -D__i386 -D__linux -As
ystem(posix) -D_LANGUAGE_FORTRAN -traditional -Asystem(unix) -Ac
pu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ /dev/null
/dev/null
> GNU CPP version egcs-2.91.66 19990314/Linux (egcs-1.1.2
release) (i386 Linux/ELF)
> #include "..." search starts here:
> #include <...> search starts here:
>  /usr/local/include
>  /usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/include
>  /usr/include
> End of search list.
>

/usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/f771 -fnull-v
ersion -quiet -dumpbase g77-version.f -version -fversion -o
/tmp/ccStiDag.s /dev/null
> GNU F77 version egcs-2.91.66 19990314/Linux (egcs-1.1.2
release) (i386-slackware-linux) 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/i386-slackware-linux/bin/as -V -Qy -o /tmp/ccgtlWDn.o
/tmp/ccStiDag.s
> GNU assembler version 2.9.1 (i386-slackware-linux), using BFD
version 2.9.1.0.25
>  /usr/i386-slackware-linux/bin/ld -m elf_i386 -dynamic-linker
/lib/ld-linux.so.2 -o /tmp/ccerWHQw /tmp/ccgtlWDn.o
/usr/lib/crt1.o /usr/lib/crti.o
/usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/crtbegin.o -L
/usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66 -L/usr/i386-s
lackware-linux/lib -lg2c -lm -lgcc -lc -lgcc
/usr/lib/gcc-lib/i386-slackware-linux/egcs-2.91.66/crtend.o
/usr/lib/crtn.o
>  /tmp/ccerWHQw
> __G77_LIBF77_VERSION__: 0.5.24
> @(#)LIBF77 VERSION 19970919
> __G77_LIBI77_VERSION__: 0.5.24-19981021
> @(#) LIBI77 VERSION pjw,dmg-mods 19980617
> __G77_LIBU77_VERSION__: 0.5.24-19990305
> @(#) LIBU77 VERSION 19980709
>
> --------------------------------------------------------------
-------


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