From: Mikael Morin <morin-mikael@orange.fr>
To: Harald Anlauf <anlauf@gmx.de>, Mikael Morin <mikael@gcc.gnu.org>,
fortran@gcc.gnu.org, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH] fortran: Restore interface to its previous state on error [PR48776]
Date: Wed, 30 Aug 2023 10:30:27 +0200 [thread overview]
Message-ID: <1b82b126-e037-4a96-a9a3-23f66686a1cf@orange.fr> (raw)
In-Reply-To: <eda7daf6-e290-45d2-8390-f4bd5d169555@gmx.de>
Le 28/08/2023 à 21:17, Harald Anlauf via Fortran a écrit :
> Hi Mikael,
>
> On 8/27/23 21:22, Mikael Morin via Gcc-patches wrote:
>> Hello,
>>
>> this fixes an old error-recovery bug.
>> Tested on x86_64-pc-linux-gnu.
>>
>> OK for master?
>
> I have only a minor comment:
>
>> +/* Free the leading members of the gfc_interface linked list given in
>> INTR
>> + up to the END element (exclusive: the END element is not freed).
>> + If END is not nullptr, it is assumed that END is in the linked
>> list starting
>> + with INTR. */
>> +
>> +static void
>> +free_interface_elements_until (gfc_interface *intr, gfc_interface *end)
>> +{
>> + gfc_interface *next;
>> +
>> + for (; intr != end; intr = next)
>
> Would it make sense to add a protection for intr == NULL, i.e.:
>
> + for (; intr && intr != end; intr = next)
>
> Just to prevent a NULL pointer dereference in case there
> is a corruption of the chain or something else went wrong.
>
This would happen in the case END is not a member of the INTR linked
list. In that case, the most forgiving would be not freeing any memory
and just returning. But it would require walking the list a second time
to determine before proceeding if END is present, and let's not do work
that is expected to be useless.
I will just do the change as you suggest it.
> Otherwise it looks good to me.
>
> It appears that your patch similarly fixes PR107923. :-)
>
Good news. :-)
I will double check that none of the testcases there remain unfixed and
close as duplicate.
I don't know how you manage to make your way through the hundreds of
open PRs by the way.
Thanks for the review.
> Thanks for the patch!
>
> Harald
>
>
prev parent reply other threads:[~2023-08-30 8:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-27 19:22 Mikael Morin
2023-08-28 19:17 ` Harald Anlauf
2023-08-30 8:30 ` Mikael Morin [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=1b82b126-e037-4a96-a9a3-23f66686a1cf@orange.fr \
--to=morin-mikael@orange.fr \
--cc=anlauf@gmx.de \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=mikael@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).