https://gcc.gnu.org/g:b41bfa4cb3e1bd761d0c52b0aad9777ef9ac7f18

commit r16-8991-gb41bfa4cb3e1bd761d0c52b0aad9777ef9ac7f18
Author: Steve Baird <[email protected]>
Date:   Wed Jan 21 14:42:31 2026 -0800

    ada: Deep delta aggregates incorrectly rejected with -gnatX.
    
    To enable the use of deep delta aggregates, it should only be necessary to
    enable core extensions (e.g., via -gnatX) as opposed to enabling all
    extensions (e.g., via -gnatX0).
    
    gcc/ada/ChangeLog:
    
            * doc/gnat_rm/gnat_language_extensions.rst: Correct example
            to avoid using a not-yet-implemented form of deep delta aggregate.
            * exp_aggr.adb (Make_Delta_Choice_LHS): Call Core_Extensions_Allowed
            instead of All_Extensions_Allowed.
            * par-ch4.adb (P_Simple_Expression): Likewise.
            * sem_aggr.adb (Resolve_Delta_Array_Aggregate): Likewise.
            * gnat_rm.texi: Regenerate.

Diff:
---
 gcc/ada/doc/gnat_rm/gnat_language_extensions.rst | 4 ++--
 gcc/ada/exp_aggr.adb                             | 2 +-
 gcc/ada/gnat_rm.texi                             | 4 ++--
 gcc/ada/par-ch4.adb                              | 4 ++--
 gcc/ada/sem_aggr.adb                             | 5 +++--
 5 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst 
b/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst
index 3a73213e60f7..92a9fc5589f6 100644
--- a/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst
+++ b/gcc/ada/doc/gnat_rm/gnat_language_extensions.rst
@@ -272,9 +272,9 @@ Examples
       S : Segment := (1 .. 2 => (0, 0));
       T : Triangle := (1 .. 3 => (1 .. 2 => (0, 0)));
    begin
-      S := (S with delta (1).X | (2).Y => 12, (1).Y => 15);
+      S := (S with delta (1).X => 11, (2).Y => 12, (1).Y => 15);
 
-      pragma Assert (S (1).X = 12);
+      pragma Assert (S (1).X = 11);
       pragma Assert (S (2).Y = 12);
       pragma Assert (S (1).Y = 15);
 
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb
index 82afcaaa0e80..4077a8e17d26 100644
--- a/gcc/ada/exp_aggr.adb
+++ b/gcc/ada/exp_aggr.adb
@@ -7848,7 +7848,7 @@ package body Exp_Aggr is
 
             else
                --  a deep delta aggregate choice
-               pragma Assert (All_Extensions_Allowed);
+               pragma Assert (Core_Extensions_Allowed);
 
                declare
                   --  recursively get name for prefix
diff --git a/gcc/ada/gnat_rm.texi b/gcc/ada/gnat_rm.texi
index c61db7d9c4e9..5a6d8372476d 100644
--- a/gcc/ada/gnat_rm.texi
+++ b/gcc/ada/gnat_rm.texi
@@ -31091,9 +31091,9 @@ declare
    S : Segment := (1 .. 2 => (0, 0));
    T : Triangle := (1 .. 3 => (1 .. 2 => (0, 0)));
 begin
-   S := (S with delta (1).X | (2).Y => 12, (1).Y => 15);
+   S := (S with delta (1).X => 11, (2).Y => 12, (1).Y => 15);
 
-   pragma Assert (S (1).X = 12);
+   pragma Assert (S (1).X = 11);
    pragma Assert (S (2).Y = 12);
    pragma Assert (S (1).Y = 15);
 
diff --git a/gcc/ada/par-ch4.adb b/gcc/ada/par-ch4.adb
index 58bac211e781..0a25ac853f76 100644
--- a/gcc/ada/par-ch4.adb
+++ b/gcc/ada/par-ch4.adb
@@ -2655,7 +2655,7 @@ package body Ch4 is
          end;
       end if;
 
-      --  If all extensions are enabled and we have a deep delta aggregate
+      --  If core extensions are enabled and we have a deep delta aggregate
       --  whose type is an array type with an element type that is a
       --  record type, then we can encounter legal things like
       --    with delta (Some_Index_Expression).Some_Component
@@ -2668,7 +2668,7 @@ package body Ch4 is
         and then Prev_Token = Tok_Right_Paren
         and then Serious_Errors_Detected = 0
         and then Inside_Delta_Aggregate
-        and then All_Extensions_Allowed
+        and then Core_Extensions_Allowed
       then
          if Token = Tok_Dot then
             Node2 := New_Node (N_Selected_Component, Token_Ptr);
diff --git a/gcc/ada/sem_aggr.adb b/gcc/ada/sem_aggr.adb
index 4bb3cb21c21f..65591d1d60aa 100644
--- a/gcc/ada/sem_aggr.adb
+++ b/gcc/ada/sem_aggr.adb
@@ -4520,7 +4520,7 @@ package body Sem_Aggr is
             Choice := First (Choice_List (Assoc));
             while Present (Choice) loop
                if Is_Deep_Choice (Choice, Typ) then
-                  pragma Assert (All_Extensions_Allowed);
+                  pragma Assert (Core_Extensions_Allowed);
                   Deep_Choice_Seen := True;
 
                   --  a deep delta aggregate
@@ -4796,7 +4796,8 @@ package body Sem_Aggr is
             Deep_Choice := Nkind (Choice) /= N_Identifier;
             if Deep_Choice then
                Error_Msg_GNAT_Extension
-                 ("deep delta aggregate", Sloc (Choice));
+                 ("deep delta aggregate", Sloc (Choice),
+                  Is_Core_Extension => True);
             end if;
 
             Comp_Type := Get_Component_Type

Reply via email to