| 1 |
! { dg-do run } |
| 2 |
! { dg-options "-fdec-structure" } |
| 3 |
! |
| 4 |
! Test UNIONs with initializations. |
| 5 |
! |
| 6 |
|
| 7 |
subroutine aborts (s) |
| 8 |
character(*), intent(in) :: s |
| 9 |
print *, s |
| 10 |
STOP 1 |
| 11 |
end subroutine |
| 12 |
|
| 13 |
! Initialization expressions |
| 14 |
structure /s3/ |
| 15 |
integer(4) :: i = 8 |
| 16 |
union ! U7 |
| 17 |
map |
| 18 |
integer(4) :: x = 1600 |
| 19 |
integer(4) :: y = 1800 |
| 20 |
end map |
| 21 |
map |
| 22 |
integer(2) a, b, c |
| 23 |
end map |
| 24 |
end union |
| 25 |
end structure |
| 26 |
|
| 27 |
record /s3/ r3 |
| 28 |
|
| 29 |
! Initialized unions |
| 30 |
if ( r3.x .ne. 1600 .or. r3.y .ne. 1800) then |
| 31 |
r3.x = r3.y ! If r3 isn't used the initializations are optimized out |
| 32 |
call aborts ("union initialization") |
| 33 |
endif |
| 34 |
|
| 35 |
end |