aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/no_arg_check_3.f90
blob: ff176fef81ac211b3b22cda1c51d6febbb69f429 (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
! { dg-do compile }
! { dg-options "-fcoarray=single" }
!
! PR fortran/39505
! 
! Test NO_ARG_CHECK
! Copied from assumed_type_2.f90
!
subroutine one(a) ! { dg-error "may not have the ALLOCATABLE, CODIMENSION, POINTER or VALUE attribute" }
!GCC$ attributes NO_ARG_CHECK :: a
  integer, value :: a
end subroutine one

subroutine two(a) ! { dg-error "may not have the ALLOCATABLE, CODIMENSION, POINTER or VALUE attribute" }
!GCC$ attributes NO_ARG_CHECK :: a
  integer, pointer :: a
end subroutine two

subroutine three(a) ! { dg-error "may not have the ALLOCATABLE, CODIMENSION, POINTER or VALUE attribute" }
!GCC$ attributes NO_ARG_CHECK :: a
  integer, allocatable :: a
end subroutine three

subroutine four(a) ! { dg-error "may not have the ALLOCATABLE, CODIMENSION, POINTER or VALUE attribute" }
!GCC$ attributes NO_ARG_CHECK :: a
  integer  :: a[*]
end subroutine four

subroutine five(a) ! { dg-error "with NO_ARG_CHECK attribute shall either be a scalar or an assumed-size array" }
!GCC$ attributes NO_ARG_CHECK :: a
  integer :: a(3)
end subroutine five

subroutine six()
!GCC$ attributes NO_ARG_CHECK :: nodum ! { dg-error "with NO_ARG_CHECK attribute shall be a dummy argument" }
  integer :: nodum
end subroutine six

subroutine seven(y)
!GCC$ attributes NO_ARG_CHECK :: y
 integer :: y(*)
 call a7(y(3:5)) ! { dg-error "with NO_ARG_CHECK attribute shall not have a subobject reference" }
contains
 subroutine a7(x)
!GCC$ attributes NO_ARG_CHECK :: x
   integer :: x(*)
 end subroutine a7
end subroutine seven

subroutine nine()
  interface one
    subroutine okay(x)
!GCC$ attributes NO_ARG_CHECK :: x
      integer :: x
    end subroutine okay
  end interface
  interface two
    subroutine ambig1(x)
!GCC$ attributes NO_ARG_CHECK :: x
      integer :: x
    end subroutine ambig1
    subroutine ambig2(x)
!GCC$ attributes NO_ARG_CHECK :: x
      integer :: x(*)
    end subroutine ambig2 ! { dg-error "Ambiguous interfaces 'ambig2' and 'ambig1' in generic interface 'two'" }
  end interface
  interface three
    subroutine ambig3(x)
!GCC$ attributes NO_ARG_CHECK :: x
      integer :: x
    end subroutine ambig3
    subroutine ambig4(x)
      integer :: x
    end subroutine ambig4 ! { dg-error "Ambiguous interfaces 'ambig4' and 'ambig3' in generic interface 'three'" }
  end interface
end subroutine nine

subroutine ten()
 interface
   subroutine bar()
   end subroutine
 end interface
 type t
 contains
   procedure, nopass :: proc => bar
 end type
 type(t) :: xx
 call sub(xx) ! { dg-error "is of derived type with type-bound or FINAL procedures" }
contains
  subroutine sub(a)
!GCC$ attributes NO_ARG_CHECK :: a
    integer :: a
  end subroutine sub
end subroutine ten

subroutine eleven(x)
  external bar
!GCC$ attributes NO_ARG_CHECK :: x
  integer :: x
  call bar(x) ! { dg-error "Assumed-type argument x at .1. requires an explicit interface" }
end subroutine eleven

subroutine twelf(x)
!GCC$ attributes NO_ARG_CHECK :: x
  integer :: x
  call bar(x) ! { dg-error "Type mismatch in argument" }
contains
  subroutine bar(x)
    integer :: x
  end subroutine bar
end subroutine twelf

subroutine thirteen(x, y)
!GCC$ attributes NO_ARG_CHECK :: x
  integer :: x
  integer :: y(:)
  print *, ubound(y, dim=x) ! { dg-error "Variable with NO_ARG_CHECK attribute at .1. is only permitted as argument to the intrinsic functions C_LOC and PRESENT" }
end subroutine thirteen

subroutine fourteen(x)
!GCC$ attributes NO_ARG_CHECK :: x
  integer :: x
  x = x ! { dg-error "with NO_ARG_CHECK attribute may only be used as actual argument" }
end subroutine fourteen