https://gcc.gnu.org/g:1af4f3759b49599d3bb5a966d3002c164ff86797
commit r17-934-g1af4f3759b49599d3bb5a966d3002c164ff86797 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 6d1647f96cd6..625e93d443a0 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -29435,13 +29435,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;
