public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r13-1662] [Ada] Fix crash on frontend inlining of functions with single returns
@ 2022-07-13 10:03 Pierre-Marie de Rodat
  0 siblings, 0 replies; only message in thread
From: Pierre-Marie de Rodat @ 2022-07-13 10:03 UTC (permalink / raw)
  To: gcc-cvs

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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-07-13 10:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-13 10:03 [gcc r13-1662] [Ada] Fix crash on frontend inlining of functions with single returns Pierre-Marie de Rodat

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