[Patch, gfortran] PR22304, 17917, 16511, 18870 and 23270 - modules,equivalences and commons
Richard E Maine
Richard.Maine@NASA.GOV
Mon Aug 22 16:01:00 GMT 2005
- Previous message (by thread): [Patch, gfortran] PR22304, 17917, 16511, 18870 and 23270 - modules, equivalences and commons
- Next message (by thread): [Patch, gfortran] PR22304, 17917, 16511, 18870 and 23270 - modules,equivalences and commons
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
On Aug 22, 2005, at 8:32 AM, Paul Thomas wrote:
> 14.6.3.3 "An EQUIVALENCE statement causes storage association of data
> objects only within one scoping unit, unless one of the equivalenced
> entities is also in a common block (5.5.1.1 and 5.5.2.1)."
>
> program foo
> common /x/ a
> a = 1
> call bar ()
> contains
> subroutine bar ()
> equivalence (a,b)
> print *, b
> end subroutine bar
> end program foo
>
> Should print the uninitialised value for b.
Well... for certain values of "should". This code is nonstandard
because it references an undefined variable, so what it "should" do is
open to debate. Printing a random uninitialized value is certainly one
likely option. (Giving an error message would be in many ways the
"nicest" option, but that one is hard).
I get the feeling that perhaps an important bit in the standard got
overlooked here, though, because the above quote has absolutely nothing
to do with this code. The EQUIVALENCE statement above does not have
anything to do with any entities in any common blocks. See 14.6.1.3(7)
in f95. By that condition, the "a" referred to in the equivalence
statement is not the "a" that is in the common block. Instead it is a
local variable to the internal procedure bar; it blocks host
association of the "a" from the main program.
--
Richard Maine | Good judgment comes from experience;
Richard.Maine@nasa.gov | experience comes from bad judgment.
| -- Mark Twain
- Previous message (by thread): [Patch, gfortran] PR22304, 17917, 16511, 18870 and 23270 - modules, equivalences and commons
- Next message (by thread): [Patch, gfortran] PR22304, 17917, 16511, 18870 and 23270 - modules,equivalences and commons
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Fortran
mailing list