aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJavier Miranda <miranda@adacore.com>2024-12-04 17:49:01 +0000
committerMarc Poulhiès <dkm@gcc.gnu.org>2025-01-06 10:14:46 +0100
commitfd52383f3f90de94e048e7902437b08eafa4adac (patch)
tree07a2b7b0063f8aab2160cb87e06ea5b31b3c6414
parentb8a94b0ba884bdd36f285565dbdf095e076fd63c (diff)
downloadgcc-fd52383f3f90de94e048e7902437b08eafa4adac.zip
gcc-fd52383f3f90de94e048e7902437b08eafa4adac.tar.gz
gcc-fd52383f3f90de94e048e7902437b08eafa4adac.tar.bz2
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.
-rw-r--r--gcc/ada/sem_ch6.adb6
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index ab12f22..2e619d8 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,