RISC-V: Regenerate opt urls.
[official-gcc.git] / gcc / testsuite / gfortran.dg / PR85868A.f90
blob621b874306bd344a86629a0bea7f7afff13d692a
1 ! { dg-do run }
3 ! PR fortran/85868
5 ! Contributed by Harald Anlauf <anlauf@gmx.de>
6 !
8 program test
10 implicit none
12 integer, parameter :: e(*) = [1, 1, -1, -1, 0, 0, 1]
14 integer, pointer :: t(:), u(:)
15 integer :: i
17 allocate (t(-1:5))
18 do i = -1, 5
19 t(i) = i
20 end do
21 call p (t, e(1)) ! Pointer with lower bound = -1 from allocation
22 u => t ! Pointer assignment sets same lower bound
23 call p (u, e(2))
25 u => t(:) ! Pointer assignment with implicit lower bound (1)
26 call p (u, e(3))
27 call p (t(:), e(4)) ! Full array, behaves the same
29 call p (t(0:), e(5)) ! Array section
30 u => t(0:) ! Pointer assignment with implicit lower bound (1)
31 call p (u, e(6))
32 u(0:) => t(0:) ! Pointer assignment with given lower bound (0)
33 call p (u, e(7))
34 stop
36 contains
38 subroutine p (a, v)
39 integer, pointer, intent(in) :: a(:)
40 integer, intent(in) :: v
42 if(a(1)/=v) stop 1001
43 return
44 end subroutine p
46 end program test