public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mikael at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/113377] Wrong code passing optional dummy argument to elemental procedure with optional dummy
Date: Sun, 14 Jan 2024 10:51:17 +0000	[thread overview]
Message-ID: <bug-113377-4-b2ANqwTCSc@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-113377-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113377

Mikael Morin <mikael at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |mikael at gcc dot gnu.org

--- Comment #1 from Mikael Morin <mikael at gcc dot gnu.org> ---
(In reply to anlauf from comment #0)
> The dump-tree suggests that the scalarizer sees the loop invariant j,
> unconditionally dereferences it outside the loop,

Note that the copy to the variable before the loop does NOT dereference the
pointer.
This case is explicitly supported by the scalarizer, see
gfc_scalar_elemental_arg_saved_as_reference (and
gfc_walk_elemental_function_args for the initialization of the can_be_null_ref
field).

Normally this is sufficient to support optional dummies (there is also
additional support for class wrappers in gfc_conv_procedure_call), except if
value comes into play.

> generates code that
> unconditionally dereferences j in the invocation of two, and uses a
> wrong interface:
These are the topics to investigate.
I suppose we need to duplicate (or factor) the code for optional, value dummies
that was added for non-elemental procedures in gfc_conv_procedure_call.

  reply	other threads:[~2024-01-14 10:51 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-13 14:21 [Bug fortran/113377] New: " anlauf at gcc dot gnu.org
2024-01-14 10:51 ` mikael at gcc dot gnu.org [this message]
2024-01-14 20:05 ` [Bug fortran/113377] " anlauf at gcc dot gnu.org
2024-01-16 21:05 ` anlauf at gcc dot gnu.org
2024-01-16 22:02 ` anlauf at gcc dot gnu.org
2024-01-19 18:46 ` mikael at gcc dot gnu.org
2024-01-19 19:25 ` mikael at gcc dot gnu.org
2024-01-19 21:16 ` anlauf at gcc dot gnu.org
2024-01-19 21:19 ` anlauf at gcc dot gnu.org
2024-01-21 20:24 ` cvs-commit at gcc dot gnu.org
2024-01-24 19:28 ` cvs-commit at gcc dot gnu.org
2024-01-25 18:26 ` anlauf at gcc dot gnu.org
2024-01-28 19:26 ` cvs-commit 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-113377-4-b2ANqwTCSc@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).