2 ! { dg-options "-fno-automatic -finit-local-zero -fdump-tree-original" }
6 ! Make sure variables are saved with -fno-automatic except in
7 ! functions marked RECURSIVE, and that they are still initialized with
14 integer a
! should be SAVEd
15 a
= a
+ x
! should increment by y every time
26 integer a
! should be SAVEd
27 a
= a
+ x
! should increment by y every time
35 recursive function g (x
)
38 integer b
! should be automatic
39 b
= b
+ x
! should be set to y every time
44 recursive function g2 (x
)
50 integer b
! should be automatic
51 b
= b
+ x
! should be set to y every time
62 ! Should return static value of a; accumulates y
63 if ( f(3) .ne
. 3 ) call abort ()
64 if ( f(4) .ne
. 7 ) call abort ()
65 if ( f(2) .ne
. 9 ) call abort ()
67 if ( f2(3) .ne
. 3 ) call abort ()
68 if ( f2(4) .ne
. 7 ) call abort ()
69 if ( f2(2) .ne
. 9 ) call abort ()
71 ! Should return automatic value of a; equal to y each time
72 if ( g(3) .ne
. 3 ) call abort ()
73 if ( g(4) .ne
. 4 ) call abort ()
74 if ( g(2) .ne
. 2 ) call abort ()
76 if ( g2(3) .ne
. 3 ) call abort ()
77 if ( g2(4) .ne
. 4 ) call abort ()
78 if ( g2(2) .ne
. 2 ) call abort ()
82 ! { dg-final { scan-tree-dump-times " static integer\\\(kind=4\\\) a = 0;" 2 "original" } }
83 ! { dg-final { scan-tree-dump-times " b = 0;" 2 "original" } }