https://gcc.gnu.org/g:908bb8e723d2193fb0b2536027cba0268effd504

commit r16-9018-g908bb8e723d2193fb0b2536027cba0268effd504
Author: Eric Botcazou <[email protected]>
Date:   Mon Mar 16 08:08:05 2026 +0100

    ada: Fix assertion failure on call in object notation in entry barrier
    
    The problem is that the Original_Record_Component field is accessed without
    checking that it may be.
    
    gcc/ada/ChangeLog:
    
            * sem_util.adb (Statically_Names_Object) <N_Selected_Component>:
            Return False if the selector is neither component nor discriminant.

Diff:
---
 gcc/ada/sem_util.adb | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 9ef5de29f644..c1bf51beb3d5 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -29342,13 +29342,21 @@ package body Sem_Util is
                return False;
             end if;
 
+            --  Reject for example subprogram calls in object notation
+
+            if Ekind (Entity (Selector_Name (N))) not in E_Component
+                                                       | E_Discriminant
+            then
+               return False;
+            end if;
+
             declare
                Comp : constant Entity_Id :=
                  Original_Record_Component (Entity (Selector_Name (N)));
             begin
-              --  AI12-0373 confirms that we should not call
-              --  Has_Discriminant_Dependent_Constraint here which would be
-              --  too strong.
+               --  AI12-0373 confirms that we should not call
+               --  Has_Discriminant_Dependent_Constraint here,
+               --  which would be too strong.
 
                if Is_Declared_Within_Variant (Comp) then
                   return False;

Reply via email to