! { dg-do compile }
|
! { dg-do compile }
|
! This tests the fix for PR28735 in which an ICE would be triggered in resolve_ref
|
! This tests the fix for PR28735 in which an ICE would be triggered in resolve_ref
|
! because the references to 'a' and 'b' in the dummy arguments of mysub have
|
! because the references to 'a' and 'b' in the dummy arguments of mysub have
|
! no symtrees in module bar, being private there.
|
! no symtrees in module bar, being private there.
|
!
|
!
|
! Contributed by Andrew Sampson
|
! Contributed by Andrew Sampson
|
!
|
!
|
!-- foo.F -----------------------------------------------
|
!-- foo.F -----------------------------------------------
|
module foo
|
module foo
|
implicit none
|
implicit none
|
public
|
public
|
integer, allocatable :: a(:), b(:)
|
integer, allocatable :: a(:), b(:)
|
end module foo
|
end module foo
|
|
|
!-- bar.F ---------------------------------------------
|
!-- bar.F ---------------------------------------------
|
module bar
|
module bar
|
use foo
|
use foo
|
implicit none
|
implicit none
|
private ! This triggered the ICE
|
private ! This triggered the ICE
|
public :: mysub ! since a and b are not public
|
public :: mysub ! since a and b are not public
|
|
|
contains
|
contains
|
|
|
subroutine mysub(n, parray1)
|
subroutine mysub(n, parray1)
|
integer, intent(in) :: n
|
integer, intent(in) :: n
|
real, dimension(a(n):b(n)) :: parray1
|
real, dimension(a(n):b(n)) :: parray1
|
if ((n == 1) .and. size(parray1, 1) /= 10) call abort ()
|
if ((n == 1) .and. size(parray1, 1) /= 10) call abort ()
|
if ((n == 2) .and. size(parray1, 1) /= 42) call abort ()
|
if ((n == 2) .and. size(parray1, 1) /= 42) call abort ()
|
end subroutine mysub
|
end subroutine mysub
|
end module bar
|
end module bar
|
|
|
!-- sub.F -------------------------------------------------------
|
!-- sub.F -------------------------------------------------------
|
subroutine sub()
|
subroutine sub()
|
|
|
use foo
|
use foo
|
use bar
|
use bar
|
real :: z(100)
|
real :: z(100)
|
allocate (a(2), b(2))
|
allocate (a(2), b(2))
|
a = (/1, 6/)
|
a = (/1, 6/)
|
b = (/10, 47/)
|
b = (/10, 47/)
|
call mysub (1, z)
|
call mysub (1, z)
|
call mysub (2, z)
|
call mysub (2, z)
|
|
|
return
|
return
|
end
|
end
|
|
|
!-- MAIN ------------------------------------------------------
|
!-- MAIN ------------------------------------------------------
|
use bar
|
use bar
|
call sub ()
|
call sub ()
|
end
|
end
|
|
|
! { dg-final { cleanup-modules "foo bar" } }
|
! { dg-final { cleanup-modules "foo bar" } }
|
|
|