https://gcc.gnu.org/g:65bac7957e117f7300dcd0ad61345c675acceb45

commit r17-1184-g65bac7957e117f7300dcd0ad61345c675acceb45
Author: Viljar Indus <[email protected]>
Date:   Thu Apr 9 11:22:05 2026 +0300

    ada: Fix crash in Has_Assertion_Level_Argument
    
    This method would crash if the association was not a
    N_Component_Association. As it could be something else like an
    N_Iterated_Component_Association that does not have the choices
    attribute.
    
    gcc/ada/ChangeLog:
    
            * sem_util.adb (Has_Assertion_Level_Argument): Check for
            the correct type of association.

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

diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb
index 5698b2f0fefa..43850d6cfc24 100644
--- a/gcc/ada/sem_util.adb
+++ b/gcc/ada/sem_util.adb
@@ -11510,6 +11510,11 @@ package body Sem_Util is
          end if;
 
          Assoc := First (Assocs);
+
+         if Nkind (Assoc) /= N_Component_Association then
+            return False;
+         end if;
+
          Choice := First (Choices (Assoc));
 
          if Nkind (Choice) = N_Identifier then

Reply via email to