]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Mon, 14 Oct 2013 13:43:51 +0000 (15:43 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 14 Oct 2013 13:43:51 +0000 (15:43 +0200)
2013-10-14  Tristan Gingold  <gingold@adacore.com>

* 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  <dewar@adacore.com>

* freeze.adb (Size_Known): Size is not known for packed record
with aliased components

From-SVN: r203555

gcc/ada/ChangeLog
gcc/ada/a-exexpr-gcc.adb
gcc/ada/freeze.adb

index b9092f91d670db7cc8ffbce17ab325b0e4375241..72cd47578e197a340376fe14ddfe3c2b942d5e44 100644 (file)
@@ -1,3 +1,15 @@
+2013-10-14  Tristan Gingold  <gingold@adacore.com>
+
+       * 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  <dewar@adacore.com>
+
+       * freeze.adb (Size_Known): Size is not known for packed record
+       with aliased components
+
 2013-10-14  Robert Dewar  <dewar@adacore.com>
 
        * sem_ch3.adb: Minor fix to error message.
index 98d575810c17e22cbc0598b41bfd796a9858142b..e98a15a7f396b7817af3b0268beca427c0d0ef46 100644 (file)
@@ -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;
 
    -------------------------
index 2844ebfa3289a5105eb934024465b67741dd0826..d51a73df2a207616677095570bbdae0e70d1e20d 100644 (file)
@@ -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)