I've found a strange error in Compaq Fortran V7.5-2630-48C8L under VMS
7.3-2 on ALPHA. Not the newest version, but some replies from usenet
indicated a completely different compiler shows the same bug, if indeed
it is a bug, which is rather bizarre.
This does not produce an error:
MODULE BLA
INTEGER :: I=RADIX(1)
END MODULE BLA
PROGRAM TEST
USE BLA, ONLY: I, RADIX
PRINT*, I
END PROGRAM TEST
However, this does:
MODULE BLA
INTEGER :: I=RADIX(I)
END MODULE BLA
PROGRAM TEST
USE BLA, ONLY: I, HUGE
PRINT*, I
END PROGRAM TEST
And this does as well:
MODULE BLA
INTEGER :: I=RADIX(I)
END MODULE BLA
PROGRAM TEST
USE BLA, ONLY: I, FJWEIFJOIW
PRINT*, I
END PROGRAM TEST
In both cases:
%F90-E-ERROR, Name in only-list does not exist.
which is what I would expect.
In other words, if the ONLY list contains a name which is the same as
the name of a function used in a specification statement in the
corresponding module, then no error occurs during compilation. However,
this is just a bogus object; one can't do anything with it:
PRINT*, I, RADIX
...........^
%F90-E-ERROR, This name has already been used as an intrinsic function
name. [RADIX]
So the compiler knows it is not a variable. It is not declared in the
module, merely used there like one can use intrinsic functions in
specification expressions.
These are just examples. It seems to be a general thing: if the ONLY
list contains a name which is the same as the name of a function used in
a specification statement in the corresponding module, then no error
occurs.
What is going on here?
|