diff options
author | Piotr Trojanek <trojanek@adacore.com> | 2022-07-05 23:41:43 +0200 |
---|---|---|
committer | Pierre-Marie de Rodat <derodat@adacore.com> | 2022-07-13 10:01:16 +0000 |
commit | d03a7f8c247d73258b80891c79358b745c379992 (patch) | |
tree | 21d67e9cf0fa330ba4ed675e86568d4c4e943b11 /gcc/ada/inline.adb | |
parent | 05e91ac1f89dc0b4757ac7e8ffaacd65bcdc4794 (diff) | |
download | gcc-d03a7f8c247d73258b80891c79358b745c379992.zip gcc-d03a7f8c247d73258b80891c79358b745c379992.tar.gz gcc-d03a7f8c247d73258b80891c79358b745c379992.tar.bz2 |
[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.
Diffstat (limited to 'gcc/ada/inline.adb')
-rw-r--r-- | gcc/ada/inline.adb | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb index 00c1e03..e0ff67a 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; |