1! RUN: %python %S/test_errors.py %s %flang_fc1 2!ERROR: The function result variable 'f1' may not have an explicit SAVE attribute 3function 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 10end 11 12!ERROR: The entity 'f2' with an explicit SAVE attribute must be a variable, procedure pointer, or COMMON block 13function 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 23end 24 25! SAVE statement should not trigger the above errors 26function f2b(x, y) 27 real :: x, y 28 save 29end 30 31subroutine 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 36end 37 38subroutine 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 47end 48 49subroutine s5 50 implicit none 51 integer x 52 block 53 !ERROR: No explicit type declared for 'x' 54 save x 55 end block 56end 57 58subroutine s7 59 !ERROR: 'x' appears as a COMMON block in a SAVE statement but not in a COMMON statement 60 save /x/ 61end 62 63subroutine s8a(n) 64 integer :: n 65 real :: x(n) ! OK: save statement doesn't affect x 66 save 67end 68subroutine s8b(n) 69 integer :: n 70 !ERROR: The automatic object 'x' may not have an explicit SAVE attribute 71 real, save :: x(n) 72end 73