1! RUN: %S/test_errors.sh %s %t %flang_fc1 2! REQUIRES: shell 3function 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 11end 12 13function 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 22end 23 24! SAVE statement should not trigger the above errors 25function f2b(x, y) 26 real :: x, y 27 save 28end 29 30subroutine 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 35end 36 37subroutine 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 46end 47 48subroutine s5 49 implicit none 50 integer x 51 block 52 !ERROR: No explicit type declared for 'x' 53 save x 54 end block 55end 56 57subroutine 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 66end 67 68subroutine s7 69 !ERROR: 'x' appears as a COMMON block in a SAVE statement but not in a COMMON statement 70 save /x/ 71end 72 73subroutine s8a(n) 74 integer :: n 75 real :: x(n) ! OK: save statement doesn't affect x 76 save 77end 78subroutine s8b(n) 79 integer :: n 80 !ERROR: SAVE attribute may not be applied to automatic data object 'x' 81 real, save :: x(n) 82end 83