public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Harald Anlauf <anlauf@gmx.de>
To: gcc-patches@gcc.gnu.org
Cc: fortran@gcc.gnu.org
Subject: Re: [PATCH] fortran: Restore interface to its previous state on error [PR48776]
Date: Mon, 28 Aug 2023 21:17:14 +0200	[thread overview]
Message-ID: <eda7daf6-e290-45d2-8390-f4bd5d169555@gmx.de> (raw)
Message-ID: <20230828191714.ALqZjfJRON_rrt9gZY1PEvDImqw4NbBVUAuAiFDMFZA@z> (raw)
In-Reply-To: <20230827192246.2514665-1-mikael@gcc.gnu.org>

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.

Otherwise it looks good to me.

It appears that your patch similarly fixes PR107923.  :-)

Thanks for the patch!

Harald




  reply	other threads:[~2023-08-28 19:17 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 [this message]
2023-08-28 19:17   ` Harald Anlauf
2023-08-30  8:30   ` Mikael Morin

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=eda7daf6-e290-45d2-8390-f4bd5d169555@gmx.de \
    --to=anlauf@gmx.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@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).