public inbox for
 help / color / mirror / Atom feed
From: Mikael Morin <>
To: Harald Anlauf <>, Mikael Morin <>,,
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: <> (raw)
In-Reply-To: <>

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 
>> +   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

      parent reply	other threads:[~2023-08-30  8:30 UTC|newest]

Thread overview: 4+ 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-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:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \ \ \

* 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).