aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/cray_pointers_1.f90
blob: 87ace6848bdabe151a923b05a9761ee212d3862a (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
! { dg-do compile }
! { dg-options "-fcray-pointer" }

! Bad type for pointer
subroutine err1
  real ipt
  real array(10)
  pointer (ipt, array) ! { dg-error "integer" }
end subroutine err1

! Multiple declarations for the same pointee
subroutine err2
  real array(10)
  pointer (ipt1, array)
  pointer (ipt2, array) ! { dg-error "multiple" }
end subroutine err2

! Vector assignment to an assumed size array
subroutine err3
  real target(10)
  real array(*)
  pointer (ipt, array)
  ipt = loc (target)
  array = 0    ! { dg-error "upper bound in the last dimension" }
end subroutine err3

subroutine err4
  pointer (ipt, ipt) ! { dg-error "POINTER attribute" }
end subroutine err4

! duplicate array specs
subroutine err5
  pointer (ipt, array(7))
  real array(10)      ! { dg-error "Duplicate array" }  
end subroutine err5

subroutine err6
  real array(10)
  pointer (ipt, array(7))  ! { dg-error "Duplicate array" }
end subroutine err6

! parsing stuff
subroutine err7
  pointer (                  ! { dg-error "variable name" }
  pointer (ipt               ! { dg-error "Expected" }
  pointer (ipt,              ! { dg-error "variable name" }
  pointer (ipt,a1            ! { dg-error "Expected" }
  pointer (ipt,a2),          ! { dg-error "Expected" }
  pointer (ipt,a3),(         ! { dg-error "variable name" }
  pointer (ipt,a4),(ipt2     ! { dg-error "Expected" }
  pointer (ipt,a5),(ipt2,    ! { dg-error "variable name" }
  pointer (ipt,a6),(ipt2,a7  ! { dg-error "Expected" }
end subroutine err7

! more attributes
subroutine err8(array)
  real array(10)
  integer dim(2)
  integer, pointer :: f90ptr
  integer, target :: f90targ
  pointer (ipt, array)    ! { dg-error "DUMMY" }
  pointer (dim, elt1)     ! { dg-error "DIMENSION" }
  pointer (f90ptr, elt2)  ! { dg-error "POINTER" }
  pointer (ipt, f90ptr)   ! { dg-error "POINTER" }
  pointer (f90targ, elt3) ! { dg-error "TARGET" }
  pointer (ipt, f90targ)  ! { dg-error "TARGET" }
end subroutine err8