]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Crash on aggregate for tagged record with discriminants
authorJavier Miranda <miranda@adacore.com>
Mon, 3 Apr 2023 17:15:47 +0000 (17:15 +0000)
committerMarc Poulhiès <poulhies@adacore.com>
Mon, 29 May 2023 08:23:19 +0000 (10:23 +0200)
The frontend may crash processing an aggregate initializing
a derived tagged record type that has discriminants.

gcc/ada/

* sem_aggr.adb
(Resolve_Record_Aggregate): For aggregates of derived tagged
record types with discriminants, when collecting components
from ancestors, pass to subprogram Gather_Components the
parent type. Required to report errors on wrong aggregate
components.

gcc/ada/sem_aggr.adb

index fd0779e66d7d970456825d9f6b36325bb0ae0f0a..edd495b83592101ba5fc81575bfb0b0236d9f9a4 100644 (file)
@@ -5632,7 +5632,7 @@ package body Sem_Aggr is
                end if;
 
                Record_Def := Type_Definition (Parent (Base_Type (Parent_Typ)));
-               Gather_Components (Empty,
+               Gather_Components (Parent_Typ,
                  Component_List (Record_Extension_Part (Record_Def)),
                  Governed_By   => New_Assoc_List,
                  Into          => Components,