1! RUN: %B/test/Semantics/test_errors.sh %s %flang %t
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  !ERROR: SAVE attribute may not be applied to dummy argument 'y'
19  integer, save :: y
20end
21
22subroutine s3(x)
23  !ERROR: SAVE attribute may not be applied to dummy argument 'x'
24  procedure(integer), pointer, save :: x
25  !ERROR: Procedure 'y' with SAVE attribute must also have POINTER attribute
26  procedure(integer), save :: y
27end
28
29subroutine s4
30  !ERROR: Explicit SAVE of 'z' is redundant due to global SAVE statement
31  save z
32  save
33  procedure(integer), pointer :: x
34  !ERROR: Explicit SAVE of 'x' is redundant due to global SAVE statement
35  save :: x
36  !ERROR: Explicit SAVE of 'y' is redundant due to global SAVE statement
37  integer, save :: y
38end
39
40subroutine s5
41  implicit none
42  integer x
43  block
44    !ERROR: No explicit type declared for 'x'
45    save x
46  end block
47end
48
49subroutine s6
50  save x
51  save y
52  !ERROR: SAVE attribute was already specified on 'y'
53  integer, save :: y
54  integer, save :: z
55  !ERROR: SAVE attribute was already specified on 'x'
56  !ERROR: SAVE attribute was already specified on 'z'
57  save x,z
58end
59
60subroutine s7
61  !ERROR: 'x' appears as a COMMON block in a SAVE statement but not in a COMMON statement
62  save /x/
63end
64