------- Comment #3 from burnus at gcc dot gnu dot org  2008-07-23 16:12 -------
Test case for the run-time check. Only for the second call a warning is needed.
One way to add it is the following. One simply inserts

  if (parm.1.data != D.1036)
    printf("test.f90:5: In call to FOO, an array temporary "
           "was created for argument #1\n");

between the following lines:

      D.1036 = _gfortran_internal_pack (&parm.1);
      foo (D.1036);

(The "if" line is copied from the  _gfortran_internal_unpack block.)


Test case:

program test
  implicit none
  integer :: a(3,3)
  call foo(a(:,1))  ! OK, no temporary created
  call foo(a(1,:))  ! BAD, temporary var created
contains
  subroutine foo(x)
    integer :: x(3)
    x = 5
  end subroutine foo
end program test


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29952

Reply via email to