2020-05-12 02:38:53 +08:00
|
|
|
! RUN: %S/test_errors.sh %s %t %f18
|
2019-02-28 03:12:16 +08:00
|
|
|
function f1(x, y)
|
|
|
|
integer x
|
|
|
|
!ERROR: SAVE attribute may not be applied to dummy argument 'x'
|
|
|
|
!ERROR: SAVE attribute may not be applied to dummy argument 'y'
|
|
|
|
save x,y
|
|
|
|
integer y
|
|
|
|
!ERROR: SAVE attribute may not be applied to function result 'f1'
|
|
|
|
save f1
|
|
|
|
end
|
|
|
|
|
|
|
|
function f2(x, y)
|
|
|
|
!ERROR: SAVE attribute may not be applied to function result 'f2'
|
|
|
|
real, save :: f2
|
|
|
|
!ERROR: SAVE attribute may not be applied to dummy argument 'x'
|
|
|
|
complex, save :: x
|
|
|
|
allocatable :: y
|
2020-06-23 02:32:54 +08:00
|
|
|
integer :: y
|
2019-02-28 03:12:16 +08:00
|
|
|
!ERROR: SAVE attribute may not be applied to dummy argument 'y'
|
2020-06-23 02:32:54 +08:00
|
|
|
save :: y
|
|
|
|
end
|
|
|
|
|
|
|
|
! SAVE statement should not trigger the above errors
|
|
|
|
function f2b(x, y)
|
|
|
|
real :: x, y
|
|
|
|
save
|
2019-02-28 03:12:16 +08:00
|
|
|
end
|
|
|
|
|
|
|
|
subroutine s3(x)
|
|
|
|
!ERROR: SAVE attribute may not be applied to dummy argument 'x'
|
|
|
|
procedure(integer), pointer, save :: x
|
|
|
|
!ERROR: Procedure 'y' with SAVE attribute must also have POINTER attribute
|
|
|
|
procedure(integer), save :: y
|
|
|
|
end
|
|
|
|
|
|
|
|
subroutine s4
|
|
|
|
!ERROR: Explicit SAVE of 'z' is redundant due to global SAVE statement
|
|
|
|
save z
|
|
|
|
save
|
|
|
|
procedure(integer), pointer :: x
|
|
|
|
!ERROR: Explicit SAVE of 'x' is redundant due to global SAVE statement
|
|
|
|
save :: x
|
|
|
|
!ERROR: Explicit SAVE of 'y' is redundant due to global SAVE statement
|
|
|
|
integer, save :: y
|
|
|
|
end
|
|
|
|
|
|
|
|
subroutine s5
|
|
|
|
implicit none
|
|
|
|
integer x
|
|
|
|
block
|
|
|
|
!ERROR: No explicit type declared for 'x'
|
|
|
|
save x
|
|
|
|
end block
|
|
|
|
end
|
|
|
|
|
|
|
|
subroutine s6
|
|
|
|
save x
|
|
|
|
save y
|
|
|
|
!ERROR: SAVE attribute was already specified on 'y'
|
|
|
|
integer, save :: y
|
|
|
|
integer, save :: z
|
|
|
|
!ERROR: SAVE attribute was already specified on 'x'
|
|
|
|
!ERROR: SAVE attribute was already specified on 'z'
|
|
|
|
save x,z
|
|
|
|
end
|
|
|
|
|
|
|
|
subroutine s7
|
|
|
|
!ERROR: 'x' appears as a COMMON block in a SAVE statement but not in a COMMON statement
|
|
|
|
save /x/
|
|
|
|
end
|
2020-07-16 04:02:32 +08:00
|
|
|
|
|
|
|
subroutine s8a(n)
|
|
|
|
integer :: n
|
|
|
|
real :: x(n) ! OK: save statement doesn't affect x
|
|
|
|
save
|
|
|
|
end
|
|
|
|
subroutine s8b(n)
|
|
|
|
integer :: n
|
|
|
|
!ERROR: SAVE attribute may not be applied to automatic data object 'x'
|
|
|
|
real, save :: x(n)
|
|
|
|
end
|