| 1 |
! { dg-do compile } |
| 2 |
! { dg-options "-fmax-array-constructor=65536 -fdump-tree-original" } |
| 3 |
! PR fortran/103794 |
| 4 |
|
| 5 |
program p |
| 6 |
integer :: i, j |
| 7 |
integer, parameter :: a(2) = 2 |
| 8 |
integer, parameter :: e(*) = [(reshape([1,2,3,4], (a*i)), i=1,1)] |
| 9 |
integer, parameter :: f(*,*) = reshape([1,2,3,4], [(a*i, i=1,1)]) |
| 10 |
integer, parameter :: g(*,*) = reshape([([1,2,3,4],j=1,16383)],[(a*i,i=1,1)]) |
| 11 |
integer, parameter :: s1(*) = & |
| 12 |
shape(reshape([([1,2,3,4],j=1,16383)],[(a*i,i=1,1)])) |
| 13 |
logical, parameter :: l1 = all (e == [1,2,3,4]) |
| 14 |
logical, parameter :: l2 = all (f == reshape([1,2,3,4],[2,2])) |
| 15 |
logical, parameter :: l3 = size (s1) == 2 .and. all (s1 == 2) |
| 16 |
logical, parameter :: l4 = all (f == g) |
| 17 |
print *, e |
| 18 |
print *, f |
| 19 |
if (.not. l1) stop 1 |
| 20 |
if (.not. l2) stop 2 |
| 21 |
if (.not. l3) stop 3 |
| 22 |
if (.not. l4) stop 4 |
| 23 |
if (any (shape (reshape([1,2], [([2]*i, i=1,1)])) /= 2)) stop 5 |
| 24 |
! The following is compile-time simplified due to shape(): |
| 25 |
print *, shape(reshape([([1,2,3,4],j=1,20000)],[(a*i,i=1,1)])) |
| 26 |
if (any (shape(reshape([([1,2,3,4],j=1,20000)],[(a*i,i=1,1)])) /= 2)) stop 6 |
| 27 |
if (any (reshape([([1,2,3,4],j=1,16383)],[(a*i,i=1,1)]) /= f)) stop 7 |
| 28 |
! The following is not compile-time simplified: |
| 29 |
print *, reshape([([1,2,3,4],j=1,20000)],[(a*i,i=1,1)]) |
| 30 |
if (any (reshape([([1,2,3,4],j=1,20000)],[(a*i,i=1,1)]) /= f)) stop 8 |
| 31 |
end |
| 32 |
|
| 33 |
! { dg-final { scan-tree-dump-times "_gfortran_reshape_4" 2 "original" } } |
| 34 |
! { dg-final { scan-tree-dump-times "_gfortran_stop_numeric" 1 "original" } } |