| 1 |
! PR Fortran/71523 |
| 2 |
! |
| 3 |
! { dg-do run } |
| 4 |
! { dg-options "-finit-integer=12345 -fautomatic -fmax-stack-var-size=8" } |
| 5 |
! |
| 6 |
! Make sure that variables larger than max-stack-var-size become |
| 7 |
! static and are given the correct _static_ initializer. |
| 8 |
! |
| 9 |
|
| 10 |
function set(idx, val) |
| 11 |
implicit none |
| 12 |
integer, intent(in) :: idx, val |
| 13 |
integer set |
| 14 |
integer arr(100) |
| 15 |
|
| 16 |
set = arr(idx) |
| 17 |
arr(idx) = val |
| 18 |
return |
| 19 |
end function |
| 20 |
|
| 21 |
integer set, val |
| 22 |
|
| 23 |
val = set(1, 5) |
| 24 |
if (val .ne. 12345) then |
| 25 |
STOP 1 |
| 26 |
endif |
| 27 |
|
| 28 |
val = set(1, 10) |
| 29 |
if (val .ne. 5) then |
| 30 |
STOP 2 |
| 31 |
endif |
| 32 |
|
| 33 |
val = set(1, 100) |
| 34 |
if (val .ne. 10) then |
| 35 |
STOP 3 |
| 36 |
endif |
| 37 |
|
| 38 |
end |