OSDN Git Service

2007-12-08 Tobias Burnus <burnus@net-b.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / pr15957.f90
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)) call abort()
19 if (any(j /= m)) call abort()
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)) call abort()
24 o = reshape ((/1,2,3,4,5,6/), (/2,4/), (/0,0/), (/2,1/))
25 if (any(o /= m)) call abort()
26 end 
27