OpenCores
URL https://opencores.org/ocsvn/openrisc_me/openrisc_me/trunk

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gfortran.dg/] [module_private_array_refs_1.f90] - Diff between revs 149 and 154

Go to most recent revision | Only display areas with differences | Details | Blame | View Log

Rev 149 Rev 154
! { 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" } }
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.