aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/gfortran.dg/assumed_type_3.f90
blob: e5bff509e40c179be993700a6c41d315bf3d2e13 (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
! { dg-do compile }
! { dg-options "-fcoarray=single" }
!
! PR fortran/48820
!
! Test TYPE(*)

subroutine one(a) ! { dg-error "may not have the ALLOCATABLE, CODIMENSION, POINTER or VALUE attribute" }
  type(*), value :: a
end subroutine one

subroutine two(a) ! { dg-error "may not have the ALLOCATABLE, CODIMENSION, POINTER or VALUE attribute" }
  type(*), pointer :: a
end subroutine two

subroutine three(a) ! { dg-error "may not have the ALLOCATABLE, CODIMENSION, POINTER or VALUE attribute" }
  type(*), allocatable :: a
end subroutine three

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

subroutine five(a) ! { dg-error "shall not be an explicit-shape array" }
  type(*) :: a(3)
end subroutine five

subroutine six()
  type(*) :: nodum ! { dg-error "is only permitted for dummy variables" }
end subroutine six

subroutine seven(y)
 type(*) :: y(:)
 call a7(y(3:5)) ! { dg-error "Assumed-type variable y at .1. shall not have a subobject reference" }
contains
 subroutine a7(x)
   type(*) :: x(*)
 end subroutine a7
end subroutine seven

subroutine eight()
  type t
    type(*) :: x ! { dg-error "is not allowed for components" }
  end type t
end subroutine eight

subroutine nine()
  interface one
    subroutine okay(x)
      type(*) :: x
    end subroutine okay
    subroutine okay2(x)
      type(*) :: x(*)
    end subroutine okay2
    subroutine okay3(x,y)
      integer :: x
      type(*) :: y
    end subroutine okay3
  end interface
  interface two
    subroutine okok1(x)
      type(*) :: x
    end subroutine okok1
    subroutine okok2(x)
      integer :: x(*)
    end subroutine okok2
  end interface
  interface three
    subroutine ambig1(x)
      type(*) :: x
    end subroutine ambig1
    subroutine ambig2(x)
      integer :: x
    end subroutine ambig2 ! { dg-error "Ambiguous interfaces 'ambig2' and 'ambig1' 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)
    type(*) :: a
  end subroutine sub
end subroutine ten

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

subroutine twelf(x)
  type(*) :: 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)
  type(*) :: x
  integer :: y(:)
  print *, ubound(y, dim=x) ! { dg-error "Assumed-type argument at .1. is only permitted as first actual argument to the intrinsic ubound" }
end subroutine thirteen

subroutine fourteen(x)
  type(*) :: x
  x = x ! { dg-error "Assumed-type variable x at .1. may only be used as actual argument" }
end subroutine fourteen