https://gcc.gnu.org/g:fd52383f3f90de94e048e7902437b08eafa4adac

commit r15-6576-gfd52383f3f90de94e048e7902437b08eafa4adac
Author: Javier Miranda <mira...@adacore.com>
Date:   Wed Dec 4 17:49:01 2024 +0000

    ada: Cleanup preanalysis of static expressions
    
    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.

Diff:
---
 gcc/ada/sem_ch6.adb | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index ab12f22ad51a..2e619d89444a 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -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,

Reply via email to