73 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc12!ERROR: The function result variable 'f1' may not have an explicit SAVE attribute3function f1(x, y)4 !ERROR: The dummy argument 'x' may not have an explicit SAVE attribute5 integer x6 save x,y7 !ERROR: The dummy argument 'y' may not have an explicit SAVE attribute8 integer y9 save f110end11 12!ERROR: The entity 'f2' with an explicit SAVE attribute must be a variable, procedure pointer, or COMMON block13function f2(x, y) result(r)14 save f215 !ERROR: The function result variable 'r' may not have an explicit SAVE attribute16 real, save :: r17 !ERROR: The dummy argument 'x' may not have an explicit SAVE attribute18 complex, save :: x19 allocatable :: y20 !ERROR: The dummy argument 'y' may not have an explicit SAVE attribute21 integer :: y22 save :: y23end24 25! SAVE statement should not trigger the above errors26function f2b(x, y)27 real :: x, y28 save29end30 31subroutine s3(x)32 !ERROR: The dummy argument 'x' may not have an explicit SAVE attribute33 procedure(integer), pointer, save :: x34 !ERROR: The entity 'y' with an explicit SAVE attribute must be a variable, procedure pointer, or COMMON block35 procedure(integer), save :: y36end37 38subroutine s439 !WARNING: Explicit SAVE of 'z' is redundant due to global SAVE statement [-Wredundant-attribute]40 save z41 save42 procedure(integer), pointer :: x43 !WARNING: Explicit SAVE of 'x' is redundant due to global SAVE statement [-Wredundant-attribute]44 save :: x45 !WARNING: Explicit SAVE of 'y' is redundant due to global SAVE statement [-Wredundant-attribute]46 integer, save :: y47end48 49subroutine s550 implicit none51 integer x52 block53 !ERROR: No explicit type declared for 'x'54 save x55 end block56end57 58subroutine s759 !ERROR: 'x' appears as a COMMON block in a SAVE statement but not in a COMMON statement60 save /x/61end62 63subroutine s8a(n)64 integer :: n65 real :: x(n) ! OK: save statement doesn't affect x66 save67end68subroutine s8b(n)69 integer :: n70 !ERROR: The automatic object 'x' may not have an explicit SAVE attribute71 real, save :: x(n)72end73