| 1 |
! { dg-do run } |
| 2 |
! PR 15957 |
| 3 |
! we used to return the wrong shape when the order parameter was used |
| 4 |
! in reshape. |
| 5 |
! |
| 6 |
INTEGER, parameter :: i(2,3) = reshape ((/1,2,3,4,5,6/), (/2,3/)), & |
| 7 |
j(2,4) = reshape ((/1,2,3,4,5,6/), (/2,4/), (/0,0/), (/2,1/)) |
| 8 |
|
| 9 |
integer :: k(2,3), m(2,4), n(2,3), o(2,4) |
| 10 |
|
| 11 |
k(1,:) = (/ 1, 3, 5 /) |
| 12 |
k(2,:) = (/ 2, 4, 6 /) |
| 13 |
|
| 14 |
m(1,:) = (/ 1, 2, 3, 4 /) |
| 15 |
m(2,:) = (/ 5, 6, 0, 0 /) |
| 16 |
|
| 17 |
! check that reshape does the right thing while constant folding |
| 18 |
if (any(i /= k)) STOP 1 |
| 19 |
if (any(j /= m)) STOP 2 |
| 20 |
|
| 21 |
! check that reshape does the right thing at runtime |
| 22 |
n = reshape ((/1,2,3,4,5,6/), (/2,3/)) |
| 23 |
if (any(n /= k)) STOP 3 |
| 24 |
o = reshape ((/1,2,3,4,5,6/), (/2,4/), (/0,0/), (/2,1/)) |
| 25 |
if (any(o /= m)) STOP 4 |
| 26 |
end |
| 27 |
|