| 1 |
! { dg-do compile } |
| 2 |
! { dg-options "-fdump-tree-original -Warray-temporaries" } |
| 3 |
! { dg-final { scan-tree-dump-not "stride" "original" } } |
| 4 |
! Verify that no temporary array is generated for a constant array constructor |
| 5 |
! See e.g. PR fortran/102717, PR fortran/102787 |
| 6 |
|
| 7 |
program p |
| 8 |
integer, parameter :: a(*) = [1,2,3,4] |
| 9 |
integer, parameter :: b(2,3) = reshape([1,2,3,4,5,6], shape (b)) |
| 10 |
print *, [a] |
| 11 |
print *, [a( : ) ] |
| 12 |
print *, [a( ::1)] |
| 13 |
print *, [a( ::2)] |
| 14 |
print *, [a(1:2:1)] |
| 15 |
print *, [a(4:1:-2)] |
| 16 |
print *, [a([3,2])] |
| 17 |
print *, [a,1] |
| 18 |
print *, [1,a] |
| 19 |
print *, [a,a] |
| 20 |
print *, [b(:,3:1:-2)] |
| 21 |
print *, [1,b(1,[2,1,3])] |
| 22 |
print *, [a,b] |
| 23 |
end |