From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5462 invoked by alias); 10 May 2012 19:47:19 -0000 Received: (qmail 5449 invoked by uid 22791); 10 May 2012 19:47:16 -0000 X-SWARE-Spam-Status: No, hits=-3.6 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 10 May 2012 19:47:03 +0000 From: "townsend at astro dot wisc.edu" To: gcc-bugs@gcc.gnu.org Subject: [Bug fortran/53309] New: Unnecessary temporary array creation in subroutine call Date: Thu, 10 May 2012 19:47:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: fortran X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: townsend at astro dot wisc.edu X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-05/txt/msg01124.txt.bz2 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.