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