g77 compiles illegal code in testsuite?
Bud Davis
bdavis9659@comcast.net
Fri May 23 12:57:00 GMT 2003
| I'm running the Fortran 77 code in gcc-testsuite-3.3.tar.bz2
| through g95 and I've found that 20000601-2.f contains
| illegal code for Fortran 95 and probably Fortran 77. I don't
| have the Fortran 77 standard handy, but I believe the code is
| illegal; yet g77 compiles the code without warning or error.
steven,
First off, IANALL (i am not a language lawyer). The info below
is the analysis of a FORTRAN programmer who uses UPPER CASE for
all variable names and never exceeds column 72 :)
>From the F77 standard (selectively cut and pasted):
___________________________________________________________________________________________
| |/ /| | | | |
| |/ /| Number of| Generic| Specific| Type of |
|Intrinsic Function | Definition/ /| Arguments| Name | Name | Argument | Function |
|___________________|/_________________/|__________|________|_________|__________|__________|
| |/ /| | | | | |
| |/ /| | | | | |
|Choosing Largest | max(/a/ ,/a/ ,...) | >=2 | MAX | MAX0 | Integer | Integer |
| Value | 1 2/ /| | | AMAX1 | Real | Real |
| |/ /| | | DMAX1 | Double | Double |
| |/ /| |________|_________|__________|__________|
| |/ /| | | AMAX0 | Integer | Real |
| |/ /| | | MAX1 | Real | Integer |
|___________________|/_________________/|__________|________|_________|__________|_________ |
In my interpretation, the code in question is not valid. MAX is the generic name for MAX0,AMAX1, and DMAX1,
not for AMAX0 which is the specfic intrinisic needed here.
Just to confuse things more, i compiled this snippet
INTEGER I
REAL R,NUM
NUM=MAX(I,R)
END
on a few f77 compilers:
sgi - MIPSPro-77 -- Compiles without warnings or errors
dec - f90 /f77 -- Fatal Error on type mismatch
Maybe g77 should issue a warning (when invoked with -fpedantic) ?
Of course, IMHO, g95 should be backwards compatable with g77 :)
regards,
bud davis
More information about the Gcc
mailing list