Debian Codegraph @

gcc/testsuite/gfortran.dg/array_temporaries_2.f90

raw
1 ! { dg-do run }
2 ! { dg-options "-fcheck-array-temporaries" }
3 program test
4 implicit none
5 integer :: a(3,3)
6 call foo(a(:,1)) ! OK, no temporary created
7 call foo(a(1,:)) ! BAD, temporary var created
8 contains
9 subroutine foo(x)
10 integer :: x(3)
11 x = 5
12 end subroutine foo
13 end program test
14
15 ! { dg-output "At line 7 of file .*array_temporaries_2.f90(\r*\n+)Fortran runtime warning: An array temporary was created for argument 'x' of procedure 'foo'" }