From: Harald Anlauf <anlauf@gmx.de>
To: Tobias Burnus <tobias@codesourcery.com>,
gcc-patches <gcc-patches@gcc.gnu.org>,
fortran <fortran@gcc.gnu.org>
Subject: Re: [Patch] Fortran: Fix gfc_maybe_dereference_var [PR104430]
Date: Mon, 7 Mar 2022 20:58:07 +0100 [thread overview]
Message-ID: <7db8ae11-fd88-3ac6-e9fe-c8257e23bf6e@gmx.de> (raw)
In-Reply-To: <2cd2f3b9-3b67-dc5f-de37-94c9c5002e53@codesourcery.com>
Hi Tobias,
Am 07.03.22 um 15:01 schrieb Tobias Burnus:
> The problem is that inside the main program,
> y = f(z)
> where the the result of z is
> type(t) :: z(size(x%a))
> and 'x' is a dummy argument.
>
> 'x' looses the attr.dummy in gfc_add_interface_mapping
> and this leads to an additional indirect ref in
> gfc_maybe_dereference_var - but after the first indirect
> ref, TREE_TYPE is alread a RECORD_TYPE ...
>
> The simple fix is to simply punt when the argument
> is not a pointer or reference.
>
> This patch additionally fixes a comment in
> conv_parent_component_references.
LGTM. Regarding the commit message, there should be a period
at the end of
> (gfc_maybe_dereference_var): Avoid derefereing a nonpointer
I think there are other PRs which profit from this fix.
Can you please have a look at PR99585, and in particular
the link in comment#0? ;-)
> Those parts are obvious. The only potentially risky
> change is the comparison change from a name-wise comparison
> to a pointer-based comparison. I think it is fine and the
> testsuite did not find any issue, but you prefer, I can
> also exclude it.
I was thinking about this, too. But your change will prevent
running into trouble in the (unlikely?) case c being a NULL pointer.
> OK for mainline? How about GCC 10/11 backports?
> (I think leaving out the last change, it should be very safe to do.)
OK, as this is both an ICE-on-valid and a regression.
Thanks for the patch!
Harald
> Tobias
> -----------------
> Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201,
> 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer:
> Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München;
> Registergericht München, HRB 106955
next prev parent reply other threads:[~2022-03-07 19:58 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-07 14:01 Tobias Burnus
2022-03-07 19:58 ` Harald Anlauf [this message]
2022-03-08 20:19 ` Tobias Burnus
2022-03-08 21:55 ` Harald Anlauf
2022-03-08 21:55 ` Harald Anlauf
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=7db8ae11-fd88-3ac6-e9fe-c8257e23bf6e@gmx.de \
--to=anlauf@gmx.de \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=tobias@codesourcery.com \
/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).