2 ! { dg-options "-fdec-static -finit-local-zero" }
4 ! Test AUTOMATIC and STATIC attributes.
6 subroutine assert(s
, i1
, i2
)
8 integer, intent(in
) :: i1
, i2
9 character(*), intent(in
) :: s
11 print *, s
, ": expected ", i2
, " but was ", i1
19 integer, intent(in
) :: x
, y
20 integer :: a
! only a can actually be saved
21 integer, automatic :: c
! should actually be automatic
24 ! a should be incremented by x every time and saved
28 ! c should be zeroed every time, therefore equal y
30 call assert ("f%c", c
, y
)
37 ! Should return static value of a; accumulates x
38 call assert ("f()", f(1,3), 1)
39 call assert ("f()", f(1,4), 2)
40 call assert ("f()", f(1,2), 3)