gcc/testsuite/gfortran.fortran-torture/execute/arraysave.f90
raw| 1 | ! Program to test arrays with the save attribute |
| 2 | program testarray |
| 3 | implicit none |
| 4 | integer, save, dimension (6, 5) :: a, b |
| 5 | |
| 6 | a = 0 |
| 7 | a(1, 1) = 42 |
| 8 | a(6, 5) = 43 |
| 9 | b(:,1:5) = a |
| 10 | |
| 11 | call fn (a) |
| 12 | contains |
| 13 | subroutine fn (a) |
| 14 | implicit none |
| 15 | integer, dimension(1:, 1:) :: a |
| 16 | integer, dimension(2) :: b |
| 17 | |
| 18 | b = ubound (a) |
| 19 | if (any (b .ne. (/6, 5/))) STOP 1 |
| 20 | if (a(1, 1) .ne. 42) STOP 2 |
| 21 | if (a(6, 5) .ne. 43) STOP 3 |
| 22 | end subroutine |
| 23 | end program |
| 24 |