public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
* [Bug fortran/93148] Pointer-function-result as LVALUE variable – function called multiple times with copy-in/out [not found] <bug-93148-4@http.gcc.gnu.org/bugzilla/> @ 2021-10-04 19:49 ` burnus at gcc dot gnu.org 2021-10-04 20:10 ` burnus at gcc dot gnu.org 1 sibling, 0 replies; 2+ messages in thread From: burnus at gcc dot gnu.org @ 2021-10-04 19:49 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93148 --- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> --- Also when looking at gfc_conv_subref_array_arg – the function is called seemingly up to 3 times – once per: * gfc_conv_loop_setup (&loop, &expr->where); which calls gfc_conv_loop_setup → gfc_conv_loop_setup → gfc_conv_procedure_call → gfc_trans_create_temp_array * gfc_conv_expr (&lse, expr); * gfc_conv_is_contiguous_expr (&cont_se, expr); (which calls: "gfc_conv_expr_descriptor (&array_se, expr);") ^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug fortran/93148] Pointer-function-result as LVALUE variable – function called multiple times with copy-in/out [not found] <bug-93148-4@http.gcc.gnu.org/bugzilla/> 2021-10-04 19:49 ` [Bug fortran/93148] Pointer-function-result as LVALUE variable – function called multiple times with copy-in/out burnus at gcc dot gnu.org @ 2021-10-04 20:10 ` burnus at gcc dot gnu.org 1 sibling, 0 replies; 2+ messages in thread From: burnus at gcc dot gnu.org @ 2021-10-04 20:10 UTC (permalink / raw) To: gcc-bugs https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93148 --- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> --- Additionally, it seems as if the contiguous check used for gfortran.dg/contiguous_10.f90 currently unconditionally copies in the data – which causes a problem when the pointer address escapes. (Okay, whether that works is implementation defined per F2018:15.5.2.4 paragraph 9, but it is still a missed optimizion.) – Lightly related to the issue above as the issue shows up with copy-in/copy-out. Possible fix - which causes a multi-call issue for gfortran.dg/contiguous_10.f90, see previous comment: --- a/gcc/fortran/trans-expr.c +++ b/gcc/fortran/trans-expr.c @@ -6528,5 +6528,7 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym, gfc_conv_subref_array_arg (&parmse, e, nodesc_arg, fsym->attr.intent, - fsym->attr.pointer); + fsym->attr.pointer, fsym, + sym->name, NULL, + /* check_contiguous= */ true); } else ^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-10-04 20:10 UTC | newest] Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- [not found] <bug-93148-4@http.gcc.gnu.org/bugzilla/> 2021-10-04 19:49 ` [Bug fortran/93148] Pointer-function-result as LVALUE variable – function called multiple times with copy-in/out burnus at gcc dot gnu.org 2021-10-04 20:10 ` burnus at gcc dot gnu.org
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).