]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Fix internal error on elsif part of if-statement containing if-expression
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 11 Sep 2024 17:26:18 +0000 (19:26 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 8 Oct 2024 08:37:14 +0000 (10:37 +0200)
The problem occurs when the compiler is trying to find a context to which
it can hoist finalization actions coming from the if-expression, because
Find_Hook_Context incorrectly returns the N_Elsif_Part node.

gcc/ada/ChangeLog:
PR ada/114640
* exp_util.adb (Find_Hook_Context): For a node present within a
conditional expression, do not return an N_Elsif_Part node.

gcc/ada/exp_util.adb

index 5aa0f77006c79be4d4d0b80dff719b5828885421..8b9ce9a2acc5a312982d0ec4d03080c55133fdb3 100644 (file)
@@ -6742,6 +6742,7 @@ package body Exp_Util is
                                         | N_Aggregate
                                         | N_Delta_Aggregate
                                         | N_Extension_Aggregate
+                                        | N_Elsif_Part
               and then Nkind (Parent (Par)) not in N_Function_Call
                                                  | N_Procedure_Call_Statement
                                                  | N_Entry_Call_Statement