From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2640 invoked by alias); 9 Jul 2010 12:27:20 -0000 Received: (qmail 2484 invoked by uid 48); 9 Jul 2010 12:26:55 -0000 Date: Fri, 09 Jul 2010 12:27:00 -0000 Message-ID: <20100709122655.2483.qmail@sourceware.org> X-Bugzilla-Reason: CC References: Subject: [Bug fortran/44773] [4.6 Regression] Unnecessary temporaries increase the runtime for channel.f90 by ~70% In-Reply-To: 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: 2010-07/txt/msg00992.txt.bz2 ------- Comment #16 from burnus at gcc dot gnu dot org 2010-07-09 12:26 ------- (In reply to comment #13) > What about > dudx = ddx(u(:,:,2)) > real function ddx(array) > real, dimension(:,:) :: array > call bar(u) > ddx = array(1,1) > AFAICS, this is legal and would require a temporary. I don't see why: You never have the same variable on the LHS and on the RHS. On the LHS is "dudx" == "ddx" while on the RHS is "u" == "array". As I cannot see how "u" and "dudx" can alias, I don't think one needs any temporary. Not even in any function call as the dummies are non-CONTIGUOUS assumed-shape arrays. (Otherwise, a temporary is needed as the actual argument is not simple contiguous [actually: it is known not to be contiguous].) The result 3.0 looks also fine and all my compiles produce it. > Note also that it "fixes" pr44744. Nevertheless, one should leave the PR open as the bounds checking is obviously missing. (Though, one should change the title after committal.) -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44773