[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Semantics / resolve45.f90
blob61e766356541f248a560fd706638bb7fd19f243c
1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 function 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
10 end
12 function 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
21 end
23 ! SAVE statement should not trigger the above errors
24 function f2b(x, y)
25 real :: x, y
26 save
27 end
29 subroutine 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
34 end
36 subroutine s4
37 !WARNING: Explicit SAVE of 'z' is redundant due to global SAVE statement
38 save z
39 save
40 procedure(integer), pointer :: x
41 !WARNING: Explicit SAVE of 'x' is redundant due to global SAVE statement
42 save :: x
43 !WARNING: Explicit SAVE of 'y' is redundant due to global SAVE statement
44 integer, save :: y
45 end
47 subroutine s5
48 implicit none
49 integer x
50 block
51 !ERROR: No explicit type declared for 'x'
52 save x
53 end block
54 end
56 subroutine s7
57 !ERROR: 'x' appears as a COMMON block in a SAVE statement but not in a COMMON statement
58 save /x/
59 end
61 subroutine s8a(n)
62 integer :: n
63 real :: x(n) ! OK: save statement doesn't affect x
64 save
65 end
66 subroutine s8b(n)
67 integer :: n
68 !ERROR: SAVE attribute may not be applied to automatic data object 'x'
69 real, save :: x(n)
70 end