https://gcc.gnu.org/g:22df349bbc047cd15e5df2187afc59c8c3cb3618

commit r17-851-g22df349bbc047cd15e5df2187afc59c8c3cb3618
Author: Piotr Trojanek <[email protected]>
Date:   Fri Feb 13 10:07:28 2026 +0100

    ada: Fix for illegal deep delta array aggregate with others
    
    Do not try to apply a scalar range check to "others" choice in deep delta 
array
    aggregate. This choice is illegal, but we still need to handle it in 
expansion.
    
    gcc/ada/ChangeLog:
    
            * exp_spark.adb (Expand_SPARK_N_Delta_Aggregate): Special case for
            "others" clause.

Diff:
---
 gcc/ada/exp_spark.adb | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/gcc/ada/exp_spark.adb b/gcc/ada/exp_spark.adb
index c536889619c5..5df256996183 100644
--- a/gcc/ada/exp_spark.adb
+++ b/gcc/ada/exp_spark.adb
@@ -335,13 +335,16 @@ package body Exp_SPARK is
                   elsif Is_Deep_Choice (Index, Typ) then
                      Apply_Range_Checks (Index);
 
+                  --  In delta_aggregate and Update attribute on array the
+                  --  others_choice is not allowed.
+
+                  elsif Nkind (Index) = N_Others_Choice then
+                     pragma Assert (Serious_Errors_Detected > 0);
+
                   --  Otherwise the index denotes a single expression where
                   --  range checks need to be applied or a subtype name
                   --  (without range constraints) where applying checks is
                   --  harmless.
-                  --
-                  --  In delta_aggregate and Update attribute on array the
-                  --  others_choice is not allowed.
 
                   else pragma Assert (Nkind (Index) in N_Subexpr);
                      Apply_Scalar_Range_Check (Index, Etype (Index_Typ));

Reply via email to