SAVE statement, according to 8.6.14, must apply to the same scoping unit, that excludes nested scoping units. For example, if the SAVE statement is found in a MODULE, the functions contained in that module should not inherit the SAVE attribute. I think that the code was doing this, failing the following source: ``` MODULE pippo SAVE CONTAINS PURE FUNCTION fft_stick_index( ) IMPLICIT NONE INTEGER :: fft_stick_index INTEGER :: mc !error: A pure subprogram may not have a variable with the SAVE attribute END FUNCTION END MODULE ``` Differential Revision: https://reviews.llvm.org/D88279
22 lines
387 B
Fortran
22 lines
387 B
Fortran
! RUN: %S/test_errors.sh %s %t %f18
|
|
MODULE test
|
|
SAVE
|
|
CONTAINS
|
|
PURE FUNCTION pf( )
|
|
IMPLICIT NONE
|
|
INTEGER :: pf
|
|
INTEGER :: mc
|
|
!OK: SAVE statement is not inherited by the function
|
|
END FUNCTION
|
|
|
|
PURE FUNCTION pf2( )
|
|
IMPLICIT NONE
|
|
SAVE
|
|
INTEGER :: pf2
|
|
!ERROR: A pure subprogram may not have a variable with the SAVE attribute
|
|
INTEGER :: mc
|
|
END FUNCTION
|
|
|
|
END MODULE
|
|
|