gcc/testsuite/gfortran.dg/array_temporaries_1.f90
raw| 1 | ! { dg-do compile } |
| 2 | ! { dg-options "-Warray-temporaries" } |
| 3 | |
| 4 | subroutine bar(a) |
| 5 | real, dimension(2) :: a |
| 6 | end |
| 7 | |
| 8 | program main |
| 9 | integer, parameter :: n=3 |
| 10 | integer :: i |
| 11 | real, dimension(n) :: a, b |
| 12 | |
| 13 | a = 0.2 |
| 14 | i = 2 |
| 15 | a(i:i+1) = a(1:2) ! { dg-warning "Creating array temporary" } |
| 16 | a = cshift(a,1) ! { dg-warning "Creating array temporary" } |
| 17 | b = cshift(a,1) |
| 18 | call bar(a(1:3:2)) ! { dg-warning "Creating array temporary" } |
| 19 | end program main |