public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "anlauf at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/41453] use INTENT(out) for optimization Date: Thu, 25 Aug 2022 19:31:56 +0000 [thread overview] Message-ID: <bug-41453-4-8HwLhyTT96@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-41453-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=41453 anlauf at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |anlauf at gcc dot gnu.org --- Comment #8 from anlauf at gcc dot gnu.org --- Sometimes we now generate a clobber for the wrong variable when a function result is involved. An example, derived from PR105012: ! compile with -fdump-tree-original module m contains SUBROUTINE Y (Z) real, intent(out) :: Z Z = 1. END SUBROUTINE Y FUNCTION X () real :: X CALL Y (X) ! direct use of function result, bad clobber END FUNCTION X FUNCTION F () result(res) real :: res CALL Y (res) ! using explicit result variable, good clobber END FUNCTION F end With current trunk this produces: __attribute__((fn spec (". "))) real(kind=4) f () { real(kind=4) res; res = {CLOBBER}; y (&res); return res; } __attribute__((fn spec (". "))) real(kind=4) x () { real(kind=4) __result_x; x = {CLOBBER}; y (&__result_x); return __result_x; } __attribute__((fn spec (". w "))) void y (real(kind=4) & restrict z) { *z = 1.0e+0; } For function X (without the result clause) we should have: __result_x = {CLOBBER}; instead. We probably need to have a closer look here: (gdb) l 9539,9548 9539 else if (add_clobber && expr->ref == NULL) 9540 { 9541 tree clobber; 9542 tree var; 9543 /* FIXME: This fails if var is passed by reference, see PR 9544 41453. */ 9545 var = expr->symtree->n.sym->backend_decl; 9546 clobber = build_clobber (TREE_TYPE (var)); 9547 gfc_add_modify (&se->pre, var, clobber); 9548 }
next prev parent reply other threads:[~2022-08-25 19:31 UTC|newest] Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-41453-4@http.gcc.gnu.org/bugzilla/> 2012-06-29 14:26 ` Joost.VandeVondele at mat dot ethz.ch 2013-03-29 9:04 ` Joost.VandeVondele at mat dot ethz.ch 2022-08-25 19:31 ` anlauf at gcc dot gnu.org [this message] 2022-08-25 19:58 ` [Bug fortran/41453] " anlauf at gcc dot gnu.org 2022-09-25 12:48 ` cvs-commit at gcc dot gnu.org 2022-09-25 12:48 ` cvs-commit at gcc dot gnu.org 2022-09-25 12:48 ` cvs-commit at gcc dot gnu.org 2022-09-25 12:48 ` cvs-commit at gcc dot gnu.org 2022-09-25 12:48 ` cvs-commit at gcc dot gnu.org 2022-09-25 16:42 ` mikael at gcc dot gnu.org 2022-09-25 20:32 ` tkoenig at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-41453-4-8HwLhyTT96@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).