xref: /llvm-project/flang/test/Semantics/save01.f90 (revision 996ef895cd3d1313665a42fc8e20d1d4e1cf2a28)
1! RUN: %python %S/test_errors.py %s %flang_fc1
2MODULE test
3SAVE
4CONTAINS
5PURE FUNCTION pf( )
6   IMPLICIT NONE
7   INTEGER :: pf
8   INTEGER :: mc
9   !OK: SAVE statement is not inherited by the function
10END FUNCTION
11
12PURE FUNCTION pf2( )
13   IMPLICIT NONE
14   SAVE
15   INTEGER :: pf2
16   !ERROR: A pure subprogram may not have a variable with the SAVE attribute
17   INTEGER :: mc
18END FUNCTION
19
20! This same subroutine appears in test save02.f90 where it is not an
21! error due to -fno-automatic.
22SUBROUTINE foo
23  INTEGER, TARGET :: t
24  !ERROR: An initial data target may not be a reference to an object 't' that lacks the SAVE attribute
25  INTEGER, POINTER :: p => t
26end
27
28END MODULE
29
30