| 1 |
! { dg-do compile } |
| 2 |
! |
| 3 |
! Provided by Steve Kargl. |
| 4 |
|
| 5 |
subroutine foo(n,m) |
| 6 |
integer, intent(in) :: n, m |
| 7 |
integer a(n) |
| 8 |
real b(n) |
| 9 |
equivalence(a,b) |
| 10 |
if (m /= 2) then |
| 11 |
a = 1 |
| 12 |
print *, a(1) |
| 13 |
else |
| 14 |
b = 42. |
| 15 |
print *, b(1) |
| 16 |
end if |
| 17 |
end subroutine |
| 18 |
|
| 19 |
subroutine bar(m) |
| 20 |
integer, intent(in) :: m |
| 21 |
integer x(8) |
| 22 |
real y(8) |
| 23 |
equivalence(x,y) |
| 24 |
if (m /= 2) then |
| 25 |
x = 1 |
| 26 |
print *, x(1) |
| 27 |
else |
| 28 |
y = 42. |
| 29 |
print *, y(1) |
| 30 |
end if |
| 31 |
end subroutine |
| 32 |
|
| 33 |
! { dg-error "Array '.' at .1. with non-constant bounds cannot be an EQUIVALENCE object" " " { target *-*-* } 9 } |