AMDGPU: Allow f16/bf16 for DS_READ_TR16_B64 gfx950 builtins (#118297)
[llvm-project.git] / flang / test / Semantics / resolve45.f90
blob7f6d8d6ae50b26965b74346362de70e53a126769
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 !ERROR: The function result variable 'f1' may not have an explicit SAVE attribute
3 function f1(x, y)
4 !ERROR: The dummy argument 'x' may not have an explicit SAVE attribute
5 integer x
6 save x,y
7 !ERROR: The dummy argument 'y' may not have an explicit SAVE attribute
8 integer y
9 save f1
10 end
12 !ERROR: The entity 'f2' with an explicit SAVE attribute must be a variable, procedure pointer, or COMMON block
13 function f2(x, y) result(r)
14 save f2
15 !ERROR: The function result variable 'r' may not have an explicit SAVE attribute
16 real, save :: r
17 !ERROR: The dummy argument 'x' may not have an explicit SAVE attribute
18 complex, save :: x
19 allocatable :: y
20 !ERROR: The dummy argument 'y' may not have an explicit SAVE attribute
21 integer :: y
22 save :: y
23 end
25 ! SAVE statement should not trigger the above errors
26 function f2b(x, y)
27 real :: x, y
28 save
29 end
31 subroutine s3(x)
32 !ERROR: The dummy argument 'x' may not have an explicit SAVE attribute
33 procedure(integer), pointer, save :: x
34 !ERROR: The entity 'y' with an explicit SAVE attribute must be a variable, procedure pointer, or COMMON block
35 procedure(integer), save :: y
36 end
38 subroutine s4
39 !WARNING: Explicit SAVE of 'z' is redundant due to global SAVE statement
40 save z
41 save
42 procedure(integer), pointer :: x
43 !WARNING: Explicit SAVE of 'x' is redundant due to global SAVE statement
44 save :: x
45 !WARNING: Explicit SAVE of 'y' is redundant due to global SAVE statement
46 integer, save :: y
47 end
49 subroutine s5
50 implicit none
51 integer x
52 block
53 !ERROR: No explicit type declared for 'x'
54 save x
55 end block
56 end
58 subroutine s7
59 !ERROR: 'x' appears as a COMMON block in a SAVE statement but not in a COMMON statement
60 save /x/
61 end
63 subroutine s8a(n)
64 integer :: n
65 real :: x(n) ! OK: save statement doesn't affect x
66 save
67 end
68 subroutine s8b(n)
69 integer :: n
70 !ERROR: The automatic object 'x' may not have an explicit SAVE attribute
71 real, save :: x(n)
72 end