This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/53309] New: Unnecessary temporary array creation in subroutine call
- From: "townsend at astro dot wisc.edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 10 May 2012 19:46:46 +0000
- Subject: [Bug fortran/53309] New: Unnecessary temporary array creation in subroutine call
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=53309
Bug #: 53309
Summary: Unnecessary temporary array creation in subroutine
call
Classification: Unclassified
Product: gcc
Version: 4.7.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: townsend@astro.wisc.edu
Created attachment 27367
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=27367
Example program
I'm encountering a situation where an unnecessary array is being created when
passing an assumed-shape dummy argument as the argument to a routine without an
explicit interface.
The attached example program illustrates the problem; when compiled with
-Warray-temporaries, I get the warning:
test_array_temp.f90:19.25:
call sub_set_a(3, 3, a)
1
Warning: Creating array temporary at (1)
At compile time, there is no way of determining whether a is contiguous, and so
it would seem an array temporary is necessary. However, is it possible to do a
*runtime* check on whether a is contiguous, and if so avoid the copy? Intel
Fortran seems to manage this.
BTW, this issue arises when calling many of the LAPACK and BLAS routines from
Fortran 9x; it seems array temporaries are being created all over the place,
doubtless with a performance impact.