[gcc r15-1511] ada: Fix assertion failure on predicate involving access parameter

Marc Poulhi?s dkm@gcc.gnu.org
Fri Jun 21 08:37:27 GMT 2024


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

commit r15-1511-gc5aed359a563c48f616d58f708c398f8494d7731
Author: Eric Botcazou <ebotcazou@adacore.com>
Date:   Tue May 21 19:49:32 2024 +0200

    ada: Fix assertion failure on predicate involving access parameter
    
    The assertion fails because the Original_Node of the expression has no Etype
    since its an unanalyzed identifier.
    
    gcc/ada/
    
            * accessibility.adb (Accessibility_Level): Apply the processing to
            Expr when its Original_Node is an unanalyzed identifier.

Diff:
---
 gcc/ada/accessibility.adb | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/gcc/ada/accessibility.adb b/gcc/ada/accessibility.adb
index da4d1d9ce2e2..298103377a7b 100644
--- a/gcc/ada/accessibility.adb
+++ b/gcc/ada/accessibility.adb
@@ -398,7 +398,7 @@ package body Accessibility is
 
       --  Local variables
 
-      E   : Node_Id := Original_Node (Expr);
+      E   : Node_Id;
       Pre : Node_Id;
 
    --  Start of processing for Accessibility_Level
@@ -409,6 +409,17 @@ package body Accessibility is
 
       if Present (Param_Entity (Expr)) then
          E := Param_Entity (Expr);
+
+      --  Use the original node unless it is an unanalyzed identifier, as we
+      --  don't want to reason on unanalyzed expressions from predicates.
+
+      elsif Nkind (Original_Node (Expr)) /= N_Identifier
+        or else Analyzed (Original_Node (Expr))
+      then
+         E := Original_Node (Expr);
+
+      else
+         E := Expr;
       end if;
 
       --  Extract the entity


More information about the Gcc-cvs mailing list