| 1 |
! { dg-do run } |
| 2 |
! { dg-options "-finit-integer=1 -finit-logical=true -finit-real=zero" } |
| 3 |
|
| 4 |
program init_flag_2 |
| 5 |
call real_test |
| 6 |
call logical_test |
| 7 |
call int_test |
| 8 |
call complex_test |
| 9 |
end program init_flag_2 |
| 10 |
|
| 11 |
! Test some initializations for both implicitly and |
| 12 |
! explicitly declared local variables. |
| 13 |
subroutine real_test |
| 14 |
real r1 |
| 15 |
real r2(10) |
| 16 |
dimension r3(10,10) |
| 17 |
if (r1 /= 0.0) STOP 1 |
| 18 |
if (r2(2) /= 0.0) STOP 2 |
| 19 |
if (r3(5,5) /= 0.0) STOP 3 |
| 20 |
if (r4 /= 0.0) STOP 4 |
| 21 |
end subroutine real_test |
| 22 |
|
| 23 |
subroutine logical_test |
| 24 |
logical l1 |
| 25 |
logical l2(2) |
| 26 |
if (l1 .neqv. .true.) STOP 5 |
| 27 |
if (l2(2) .neqv. .true.) STOP 6 |
| 28 |
end subroutine logical_test |
| 29 |
|
| 30 |
subroutine int_test |
| 31 |
integer i1 |
| 32 |
integer i2(10) |
| 33 |
dimension i3(10,10) |
| 34 |
if (i1 /= 1) STOP 7 |
| 35 |
if (i2(2) /= 1) STOP 8 |
| 36 |
if (i3(5,5) /= 1) STOP 9 |
| 37 |
if (i4 /= 1) STOP 10 |
| 38 |
end subroutine int_test |
| 39 |
|
| 40 |
subroutine complex_test |
| 41 |
complex c1 |
| 42 |
complex c2(20,20) |
| 43 |
if (c1 /= (0.0,0.0)) STOP 11 |
| 44 |
if (c2(1,1) /= (0.0,0.0)) STOP 12 |
| 45 |
end subroutine complex_test |