[Patch, Fortran] PR 44360 - Wrong subroutine called (use vs. host association)

Tobias Burnus burnus@net-b.de
Tue Jun 1 16:02:00 GMT 2010


As reported in PR 44360 by Vittorio Zecca (thanks!).

For
  contains
     ...
     use m, only: sub
     call sub()
     ...
  subroutine sub()

gfortran wrongly calls the host-associated ("sibling") subroutine "sub"
rather than the use-associated one of module "m".

Background: First the symbol for "call" at match time is correctly the
subroutine from "m"; however, after parsing "subroutine sub" all of
sibling routines are fixed to point to the host-associated subroutine
rather than adding a bogus external call to "sub_". However, there
checks in gfc_fix_siblings missed a check for use association and also
none of the other checks matched this case. (While use-associated
functions and variables are explicitly typed and thus don't see a
sibling "fix".)

Build and currently regtesting on x86-64-linux, if it succeeds:
OK for 4.4, 4.5, and the trunk? Should it also be applied to 4.3?

Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: use-assoc.diff
Type: text/x-patch
Size: 1952 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20100601/7e2166dc/attachment.bin>


More information about the Fortran mailing list