aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/auto_in_equiv_1.f90
blob: bf6e0c68a57f3e1ffdb2fc475ec6f952efa594e7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
! { dg-do compile }

! Contributed by Mark Eggleston <mark.eggleston@codethink.com>
program test
  call suba(0)
  call subb(0)
  call suba(1)

contains
  subroutine suba(option) 
    integer, intent(in) :: option
    integer, automatic :: a ! { dg-error "AUTOMATIC at \\(1\\) is a DEC extension" }
    integer :: b
    integer :: c
    equivalence (a, b)
    if (option.eq.0) then
      ! initialise a and c
      a = 9
      c = 99
      if (a.ne.b) stop 1
      if (loc(a).ne.loc(b)) stop 2
    else
      ! a should've been overwritten
      if (a.eq.9) stop 3
    end if
  end subroutine suba

  subroutine subb(dummy)
    integer, intent(in) :: dummy
    integer, automatic :: x ! { dg-error "AUTOMATIC at \\(1\\) is a DEC extension" }
    integer :: y
    x = 77
    y = 7
  end subroutine subb

end program test