diff options
Diffstat (limited to 'gcc/ada/exp_aggr.adb')
-rw-r--r-- | gcc/ada/exp_aggr.adb | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/gcc/ada/exp_aggr.adb b/gcc/ada/exp_aggr.adb index 9c233995c8f..10c35d37f01 100644 --- a/gcc/ada/exp_aggr.adb +++ b/gcc/ada/exp_aggr.adb @@ -264,6 +264,8 @@ package body Exp_Aggr is -- 5. The array component type is tagged, which may necessitate -- reassignment of proper tags. + -- 6. The array component type might have unaligned bit components + function Backend_Processing_Possible (N : Node_Id) return Boolean is Typ : constant Entity_Id := Etype (N); -- Typ is the correct constrained array subtype of the aggregate. @@ -317,7 +319,7 @@ package body Exp_Aggr is return False; end if; - -- Checks 4 (array must not be multi-dimensional Fortran case) + -- Checks 4 (array must not be multi-dimensional Fortran case) if Convention (Typ) = Convention_Fortran and then Number_Dimensions (Typ) > 1 @@ -350,6 +352,12 @@ package body Exp_Aggr is return False; end if; + -- Checks 6 (component type must not have bit aligned components) + + if Type_May_Have_Bit_Aligned_Components (Component_Type (Typ)) then + return False; + end if; + -- Backend processing is possible Set_Compile_Time_Known_Aggregate (N, True); @@ -1924,7 +1932,7 @@ package body Exp_Aggr is -- by Build_Task_Allocate_Block_With_Init_Stmts) declare - Ctype : Entity_Id := Etype (Selector); + Ctype : constant Entity_Id := Etype (Selector); Inside_Allocator : Boolean := False; P : Node_Id := Parent (N); @@ -3520,7 +3528,8 @@ package body Exp_Aggr is function Must_Slide (N : Node_Id; Typ : Entity_Id) return Boolean is - Obj_Type : Entity_Id := Etype (Defining_Identifier (Parent (N))); + Obj_Type : constant Entity_Id := + Etype (Defining_Identifier (Parent (N))); L1, L2, H1, H2 : Node_Id; @@ -4343,6 +4352,12 @@ package body Exp_Aggr is elsif Has_Mutable_Components (Typ) then Convert_To_Assignments (N, Typ); + -- If the type involved has any non-bit aligned components, then + -- we are not sure that the back end can handle this case correctly. + + elsif Type_May_Have_Bit_Aligned_Components (Typ) then + Convert_To_Assignments (N, Typ); + -- In all other cases we generate a proper aggregate that -- can be handled by gigi. |