------- Comment #32 from pault at gcc dot gnu dot org 2006-10-02 21:54 -------
Created an attachment (id=12373)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=12373&action=view)
A patch that fixes test_ab9.f90
You will see the modification in trans-types.c. This is the first bit of the
patch that is not specific to allocatable components, although I am hard
pressed to find a case that doesn't involve them. If you feel uncomfortable
with breaking the hermetic seal, I could make it specific. That said, this
does regtest OK, including all , the other derived type association tests.
I will write a test case tomorrow sometime and so have included my reduced
version of test_ab9.f90 from Slavatore Filippone to ensure that the audit trail
makes sense.
The problem arises because of the assignment that is used to initialize the
INTENT(OUT) derived type in gfc_conv_function_call. This exercises an
association that, I think, would not otherwise be possible. It is fixed by
usin the current namespace to start the search for like types, from any
namespace where there is no parent. The case where the derived type found is
the same as 'self' is eliminated from the search by a continue statement.
Paul
module modA
type dt
integer, allocatable :: i(:)
end type dt
end module modA
Module modB
interface
subroutine foo(x)
use modA
type(dt), intent(out) :: x
end subroutine foo
end interface
end module modB
subroutine test_ab9()
use modB ! putting this after USE modA clears the problem
use modA
type(dt) :: a
call foo(a)
return
end subroutine test_ab9
--
pault at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #12350|0 |1
is obsolete| |
Attachment #12354|0 |1
is obsolete| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20541