This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[Patch, fortran] PR34567 - A module name outside a module ?
Toon,
I've managed to get the bug reproduced with the test case in PR34567.
I would be interested to know if you can reproduce it.
The fault is indeed a problem that I cause - the worst of it is that I
even thought about it :-)
The testcase below encapsulates the problem, which I have been unable to
reproduce in any other way: The second function foo has a symbol in
it's own scope that does not have a module name. The mechanism to check
if the renamed foo obliterates the old, should not act in this case.
Thus, the check for the presence of the module name, which I already
committed, is the correct fix and I will commit this testcase too.
Thanks for the report Toon.
Happy Christmas
Paul
! { dg-do run }
! Tests the fix for PR34567 in which the module name would be used
! in a strcmp in module.c and would cause a segfault for foo(m2).
!
! This only needs to be run once.
! { dg-options "-O2" }
!
! Contributed by Toon Moene <toon@moene.indiv.nluug.nl>
!
module m1
contains
integer function foo ()
foo = 42
end function
end module m1
module m2
contains
integer function foo ()
use m1, only: foo_1 => foo
foo = foo_1 ()
end function
end module m2
use m2
if (foo () .ne. 42) call abort ()
end
! { dg-final { cleanup-modules "m1 m2" } }