This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/44773] [4.6 Regression] Unnecessary temporaries increase the runtime for channel.f90 by ~70%



------- 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]