From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30589 invoked by alias); 23 Nov 2006 09:49:47 -0000 Received: (qmail 30567 invoked by uid 48); 23 Nov 2006 09:49:39 -0000 Date: Thu, 23 Nov 2006 09:49:00 -0000 Subject: [Bug fortran/29952] New: Flag to give runtime information " array temporary was created for argument" X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "burnus at gcc dot gnu dot org" 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: 2006-11/txt/msg02019.txt.bz2 Intel has a nice feature to find bad array definitions. Somehow thinking of C I wrote: real :: coord(N,3) rather than coord(3,N). Using "ifort -check arg_temp_created" this gave then such information at run time (in my example below 20 times): "forrtl: warning (402): fort: (1): In call to DISTANCE, an array temporary was created for argument #1" While one can sometimes not prevent the need for a array temporary, one often can and should do so to speed up the program. Example program: --------------------------------- program tmp implicit none integer, parameter :: N = 20 real :: coord(N,3) ! better: (3,N) integer :: i real :: d coord = 0.0 do i=1,N d = distance(coord(i,:)) end do contains function distance(a) real :: a(3) real :: distance distance = sqrt(a(1)**2 + a(2)**2 + a(3)**2) end function distance end program tmp -- Summary: Flag to give runtime information " array temporary was created for argument" Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: burnus at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29952