• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1! RUN: %S/test_errors.sh %s %t %f18
2function f1(x, y)
3  integer x
4  !ERROR: SAVE attribute may not be applied to dummy argument 'x'
5  !ERROR: SAVE attribute may not be applied to dummy argument 'y'
6  save x,y
7  integer y
8  !ERROR: SAVE attribute may not be applied to function result 'f1'
9  save f1
10end
11
12function f2(x, y)
13  !ERROR: SAVE attribute may not be applied to function result 'f2'
14  real, save :: f2
15  !ERROR: SAVE attribute may not be applied to dummy argument 'x'
16  complex, save :: x
17  allocatable :: y
18  integer :: y
19  !ERROR: SAVE attribute may not be applied to dummy argument 'y'
20  save :: y
21end
22
23! SAVE statement should not trigger the above errors
24function f2b(x, y)
25  real :: x, y
26  save
27end
28
29subroutine s3(x)
30  !ERROR: SAVE attribute may not be applied to dummy argument 'x'
31  procedure(integer), pointer, save :: x
32  !ERROR: Procedure 'y' with SAVE attribute must also have POINTER attribute
33  procedure(integer), save :: y
34end
35
36subroutine s4
37  !ERROR: Explicit SAVE of 'z' is redundant due to global SAVE statement
38  save z
39  save
40  procedure(integer), pointer :: x
41  !ERROR: Explicit SAVE of 'x' is redundant due to global SAVE statement
42  save :: x
43  !ERROR: Explicit SAVE of 'y' is redundant due to global SAVE statement
44  integer, save :: y
45end
46
47subroutine s5
48  implicit none
49  integer x
50  block
51    !ERROR: No explicit type declared for 'x'
52    save x
53  end block
54end
55
56subroutine s6
57  save x
58  save y
59  !ERROR: SAVE attribute was already specified on 'y'
60  integer, save :: y
61  integer, save :: z
62  !ERROR: SAVE attribute was already specified on 'x'
63  !ERROR: SAVE attribute was already specified on 'z'
64  save x,z
65end
66
67subroutine s7
68  !ERROR: 'x' appears as a COMMON block in a SAVE statement but not in a COMMON statement
69  save /x/
70end
71
72subroutine s8a(n)
73  integer :: n
74  real :: x(n)  ! OK: save statement doesn't affect x
75  save
76end
77subroutine s8b(n)
78  integer :: n
79  !ERROR: SAVE attribute may not be applied to automatic data object 'x'
80  real, save :: x(n)
81end
82