From: Piotr Trojanek Date: Tue, 5 Jul 2022 21:41:43 +0000 (+0200) Subject: [Ada] Fix crash on frontend inlining of functions with single returns X-Git-Tag: basepoints/gcc-14~5545 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d03a7f8c247d73258b80891c79358b745c379992;p=thirdparty%2Fgcc.git [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 --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;