AArch64: correct constraint on Upl early clobber alternatives
[official-gcc.git] / gcc / testsuite / gfortran.dg / auto_in_equiv_1.f90
blob2791675af1b554ef3a13ea3a258d82863ac08384
1 ! { dg-do run }
2 ! { dg-options "-fdec-static -frecursive" }
4 ! Contributed by Mark Eggleston <mark.eggleston@codethink.com>
6 ! Check automatic variables can be used in equivalence statements.
7 ! Any other variables that do not explicitly have the automatic
8 ! attribute will be given the automatic attribute.
10 ! Check that variables are on the stack by incorporating the
11 ! equivalence in a recursive function.
13 program test
14 integer :: f
16 f = factorial(5)
17 if (f.ne.120) stop 2
19 contains
20 function factorial(n) result(f)
21 integer :: f
22 integer, intent(in) :: n
23 integer, automatic :: a
24 integer :: b
25 equivalence (a,b)
27 if (loc(a).ne.loc(b)) stop 1
28 b = n
29 if (a.eq.1) then
30 f = 1
31 else
32 f = a * factorial(b-1)
33 end if
34 end function
35 end program test