public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org
Subject: [gcc r13-1662] [Ada] Fix crash on frontend inlining of functions with single returns
Date: Wed, 13 Jul 2022 10:03:16 +0000 (GMT)	[thread overview]
Message-ID: <20220713100316.A5D6338515ED@sourceware.org> (raw)

https://gcc.gnu.org/g:d03a7f8c247d73258b80891c79358b745c379992

commit r13-1662-gd03a7f8c247d73258b80891c79358b745c379992
Author: Piotr Trojanek <trojanek@adacore.com>
Date:   Tue Jul 5 23:41:43 2022 +0200

    [Ada] Fix crash on frontend inlining of functions with single returns
    
    When examining expression of the first declaration of the inlined body
    make sure that this declaration is in fact an object declaration.
    
    gcc/ada/
    
            * inline.adb (Has_Single_Return): Add guard for the subsequent
            call to Expression.

Diff:
---
 gcc/ada/inline.adb | 1 +
 1 file changed, 1 insertion(+)

diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb
index 00c1e033030..e0ff67a0649 100644
--- a/gcc/ada/inline.adb
+++ b/gcc/ada/inline.adb
@@ -4648,6 +4648,7 @@ package body Inline is
          return
            Present (Declarations (N))
              and then Present (First (Declarations (N)))
+             and then Nkind (First (Declarations (N))) = N_Object_Declaration
              and then Entity (Expression (Return_Statement)) =
                         Defining_Identifier (First (Declarations (N)));
       end if;


                 reply	other threads:[~2022-07-13 10:03 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20220713100316.A5D6338515ED@sourceware.org \
    --to=pmderodat@gcc.gnu.org \
    --cc=gcc-cvs@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).