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