Open
Description
Here's a truly weird one, that I found in an old random number generator.
The Fortran standard appears to allow the following, strange, explicit "re-declaration" of a variable, that was already declared with the same type by means of implicit typing:
subroutine random( )
implicit real(kind=8) (a-h,o-z), integer(kind=4) (i-n)
save luxlev
integer(kind=4) :: luxlev
end subroutine random
I don't know what the standard truly says regarding such cases, but both gfortran, ifx, and flang-20 compile the above code without any complaints. Whereas compiling this with lfortran -c --implicit-typing random.f90
gives:
semantic error: Symbol is already declared in the same scope
--> random.f90:7:24
|
7 | integer(kind=4) :: luxlev
| ^^^^^^ redeclaration
|
5 | save luxlev
| ~~~~~~ original declaration
You may wish to investigate this, because I am truly at a loss here.
Metadata
Metadata
Assignees
Labels
No labels