This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/44773] [4.6 Regression] Unnecessary temporaries increase the runtime for channel.f90 by ~70%
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Jul 2010 12:26:55 -0000
- Subject: [Bug fortran/44773] [4.6 Regression] Unnecessary temporaries increase the runtime for channel.f90 by ~70%
- References: <bug-44773-12313@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- 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