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
|
! { dg-do compile }
! { dg-additional-options "-fcoarray=single" }
!
! TS 29113
! C407a An assumed-type entity shall be a dummy variable that does not
! have the ALLOCATABLE, CODIMENSION, INTENT(OUT), POINTER, or VALUE
! attribute and is not an explicit-shape array.
!
! This test file contains tests that are expected to issue diagnostics
! for invalid code.
! Check that diagnostics are issued when type(*) is used to declare things
! that are not dummy variables.
subroutine s0 (a)
implicit none
integer :: a
integer :: goodlocal
type(*) :: badlocal ! { dg-error "Assumed.type" }
integer :: goodcommon
type(*) :: badcommon ! { dg-error "Assumed.type" }
common /frob/ goodcommon, badcommon
integer :: goodstatic
type(*) :: badstatic ! { dg-error "Assumed.type" }
save goodstatic, badstatic
block
integer :: goodlocal2
type(*) :: badlocal2 ! { dg-error "Assumed.type" }
end block
end subroutine
module m
integer :: goodmodvar
type(*) :: badmodvar ! { dg-error "Assumed.type" }
save goodmodvar, badmodvar
type :: t
integer :: goodcomponent
type(*) :: badcomponent ! { dg-error "Assumed.type" }
end type
end module
! Check that diagnostics are issued when type(*) is used in combination
! with the forbidden attributes.
subroutine s1 (a) ! { dg-error "Assumed.type" }
implicit none
type(*), allocatable :: a
end subroutine
subroutine s2 (b) ! { dg-error "Assumed.type" }
implicit none
type(*), codimension[*] :: b(:,:)
end subroutine
subroutine s3 (c) ! { dg-error "Assumed.type" }
implicit none
type(*), intent(out) :: c
end subroutine
subroutine s4 (d) ! { dg-error "Assumed.type" }
implicit none
type(*), pointer :: d
end subroutine
subroutine s5 (e) ! { dg-error "Assumed.type" }
implicit none
type(*), value :: e
end subroutine
! Check that diagnostics are issued when type(*) is used to declare
! a dummy variable that is an explicit-shape array.
subroutine s6 (n, f) ! { dg-error "Assumed.type" }
implicit none
integer n
type(*) :: f(n,n)
end subroutine
subroutine s7 (g) ! { dg-error "Assumed.type" }
implicit none
type(*) :: g(10)
end subroutine
|