public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "burnus at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/93148] Pointer-function-result as LVALUE variable – function called multiple times with copy-in/out
Date: Mon, 04 Oct 2021 20:10:45 +0000	[thread overview]
Message-ID: <bug-93148-4-wjXMsGkQAc@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-93148-4@http.gcc.gnu.org/bugzilla/>

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

      parent reply	other threads:[~2021-10-04 20:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 [this message]

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-93148-4-wjXMsGkQAc@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: link
Be 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).