[Patch, gfortran] common blocks getting mangled in nested modules

Richard E Maine Richard.Maine@nasa.gov
Fri Aug 19 18:00:00 GMT 2005


On Aug 19, 2005, at 10:04 AM, Paul Thomas wrote:

> Richard,
>
>> As long as the local names end up different, one way or another, in 
>> the scoping unit that USEs both modules, then there is nothing wrong 
>> with using different modules which contain the same common block. 
>> This needs to work.
>
> I am just struggling with this at the moment.  This does not work, 
> even with the patch:
>
> module m1
>  common /x/ a
> end module m1
> module m2
>  common /x/ a
> end module m2
>
> program collision
>  use m1
>  use m2, only: b=>a
>  b = 1
>  print *,  b
> end program collision

Yep. That's a fine example, which I claim is standard-conforming. FWIW, 
I tried it with both NAG and in g95, as they were handy to me, and both 
worked fine on it.

-- 
Richard Maine                |  Good judgment comes from experience;
Richard.Maine@nasa.gov       |  experience comes from bad judgment.
                             |        -- Mark Twain



More information about the Fortran mailing list