This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/29952] Flag to give runtime information " array temporary was created for argument"



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]