]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Cleanup preanalysis of static expressions
authorJavier Miranda <miranda@adacore.com>
Wed, 4 Dec 2024 17:49:01 +0000 (17:49 +0000)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Mon, 6 Jan 2025 09:14:46 +0000 (10:14 +0100)
Complete previous patch; required to avoid regressions in GNATProve.

gcc/ada/ChangeLog:

* sem_ch6.adb (Analyze_Expression_Function): Set the parent of
the new node to be the parent of the original to get the proper
context, which is needed for complete error reporting and for
semantic analysis. Patch suggested by Eric Botcazou.

gcc/ada/sem_ch6.adb

index ab12f22ad51a26a91ecd5693ca3b1a47e6cef6ba..2e619d89444aa736e1603dd4903dc4b22b721361 100644 (file)
@@ -427,6 +427,12 @@ package body Sem_Ch6 is
          --  As elsewhere, we do not emit freeze nodes within a generic unit.
 
          if not Inside_A_Generic then
+            --  Set the parent of the new node to be the parent of the original
+            --  to get the proper context, which is needed for complete error
+            --  reporting and for semantic analysis.
+
+            Set_Parent (New_Body, Parent (N));
+
             Freeze_Expr_Types
               (Def_Id => Def_Id,
                Typ    => Typ,