From: Piotr Trojanek Date: Fri, 13 Feb 2026 09:07:28 +0000 (+0100) Subject: ada: Fix for illegal deep delta array aggregate with others X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=22df349bbc047cd15e5df2187afc59c8c3cb3618;p=thirdparty%2Fgcc.git 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 --git a/gcc/ada/exp_spark.adb b/gcc/ada/exp_spark.adb index c536889619c..5df25699618 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));