aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/common_pointer_1.f90
blob: e0f90ca72be95e39cca850bd55511a3fa159d7dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
! { dg-do run }
! PR13415
! Test pointer variables in common blocks.

subroutine test
  implicit none
  real, pointer :: p(:), q
  common /block/ p, q

  if (any (p .ne. (/1.0, 2.0/)) .or. (q .ne. 42.0)) call abort ()
end subroutine

program common_pointer_1
  implicit none
  real, target :: a(2), b
  real, pointer :: x(:), y
  common /block/ x, y
  
  a = (/1.0, 2.0/)
  b = 42.0
  x=>a
  y=>b
  call test
end program