view gcc/testsuite/gfortran.dg/equiv_pure.f90 @ 144:8f4e72ab4e11

fix segmentation fault caused by nothing next cur_op to end
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Sun, 23 Dec 2018 21:23:56 +0900
parents 84e7813d76e9
children
line wrap: on
line source

! { dg-do compile }
! PR fortran/82796
! Code contributed by ripero84 at gmail dot com 
module eq
   implicit none
   integer :: n1, n2
   integer, dimension(2) :: a
   equivalence (a(1), n1)
   equivalence (a(2), n2)
   common /a/ a
end module eq

module m
   use eq
   implicit none
   type, public :: t
     integer :: i
   end type t
end module m

module p
   implicit none
   contains
   pure integer function d(h)
     use m
     implicit none
     integer, intent(in) :: h
     d = h
   end function
end module p

module q
   implicit none
   contains
   pure integer function d(h)
     use m, only : t
     implicit none
     integer, intent(in) :: h
     d = h
   end function
end module q

module r
   implicit none
   contains
   pure integer function d(h)
     use m, only : a          ! { dg-error "cannot be an EQUIVALENCE object" }
     implicit none
     integer, intent(in) :: h
     d = h
   end function
end module r