diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index b9092f91d67..72cd47578e1 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,15 @@ +2013-10-14 Tristan Gingold + + * a-exexpr-gcc.adb: Adjust comment. + (Others_Value, All_Others_Value, + Unhandled_Others_Value): Declare as Character to slightly reduce + memory footprint. + +2013-10-14 Robert Dewar + + * freeze.adb (Size_Known): Size is not known for packed record + with aliased components + 2013-10-14 Robert Dewar * sem_ch3.adb: Minor fix to error message. diff --git a/gcc/ada/a-exexpr-gcc.adb b/gcc/ada/a-exexpr-gcc.adb index 98d575810c1..e98a15a7f39 100644 --- a/gcc/ada/a-exexpr-gcc.adb +++ b/gcc/ada/a-exexpr-gcc.adb @@ -295,18 +295,15 @@ package body Exception_Propagation is --------------------------------------------------------------------------- -- Currently, these only have their address taken and compared so there is - -- no real point having whole exception data blocks allocated. In any case - -- the types should match what gigi and the personality routine expect. - -- The initial value is an arbitrary value that will not exceed the range - -- of Integer on 16-bit targets (such as AAMP). + -- no real point having whole exception data blocks allocated. - Others_Value : constant Integer := 16#7FFF#; + Others_Value : constant Character := 'O'; pragma Export (C, Others_Value, "__gnat_others_value"); - All_Others_Value : constant Integer := 16#7FFF#; + All_Others_Value : constant Character := 'A'; pragma Export (C, All_Others_Value, "__gnat_all_others_value"); - Unhandled_Others_Value : constant Integer := 16#7FFF#; + Unhandled_Others_Value : constant Character := 'U'; pragma Export (C, Unhandled_Others_Value, "__gnat_unhandled_others_value"); -- Special choice (emitted by gigi) to catch and notify unhandled -- exceptions on targets which always handle exceptions (such as SEH). @@ -357,12 +354,15 @@ package body Exception_Propagation is procedure Set_Foreign_Occurrence (Excep : EOA; Mo : System.Address) is begin - Excep.Id := Foreign_Exception'Access; - Excep.Machine_Occurrence := Mo; - Excep.Msg_Length := 0; - Excep.Exception_Raised := True; - Excep.Pid := Local_Partition_ID; - Excep.Num_Tracebacks := 0; + Excep.all := ( + Id => Foreign_Exception'Access, + Machine_Occurrence => Mo, + Msg => <>, + Msg_Length => 0, + Exception_Raised => True, + Pid => Local_Partition_ID, + Num_Tracebacks => 0, + Tracebacks => <>); end Set_Foreign_Occurrence; ------------------------- diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb index 2844ebfa328..d51a73df2a2 100644 --- a/gcc/ada/freeze.adb +++ b/gcc/ada/freeze.adb @@ -835,7 +835,7 @@ package body Freeze is and then not Has_Independent_Components (T); Packed_Size : Uint := Uint_0; - -- SIze in bis so far + -- Size in bits so far begin -- Test for variant part present @@ -881,11 +881,13 @@ package body Freeze is end if; -- We do not know the packed size if we have a by reference - -- type, or an atomic type or an atomic component. + -- type, or an atomic type or an atomic component, or an + -- aliased component (because packing does not touch these). if Is_Atomic (Ctyp) or else Is_Atomic (Comp) or else Is_By_Reference_Type (Ctyp) + or else Is_Aliased (Comp) then Packed_Size_Known := False; end if; @@ -2529,6 +2531,11 @@ package body Freeze is -- clause (used to warn about useless Bit_Order pragmas, and also -- to detect cases where Implicit_Packing may have an effect). + Aliased_Component : Boolean := False; + -- Set True if we find at least one component which is aliased. This + -- is used to prevent Implicit_Packing of the record, since packing + -- cannot modify the size of alignment of an aliased component. + All_Scalar_Components : Boolean := True; -- Set False if we encounter a component of a non-scalar type @@ -2702,6 +2709,9 @@ package body Freeze is Comp := First_Entity (Rec); Prev := Empty; while Present (Comp) loop + if Is_Aliased (Comp) then + Aliased_Component := True; + end if; -- Handle the component and discriminant case @@ -3203,6 +3213,10 @@ package body Freeze is and then not Placed_Component + -- Or even one component is aliased + + and then not Aliased_Component + -- Must have size clause and all scalar components and then Has_Size_Clause (Rec)