]> gcc.gnu.org Git - gcc.git/commitdiff
ada: exp_pakd.adb: disable packed expansions in CodePeer_Mode
authorGhjuvan Lacambre <lacambre@adacore.com>
Fri, 28 Jun 2024 08:13:17 +0000 (10:13 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Thu, 1 Aug 2024 15:14:36 +0000 (17:14 +0200)
A previous commit disabled the removal of the Component_Size aspect from
GNAT's tree when in CodePeer_Mode. This effectively resulted in CodePeer
not ignoring Component_Size anymore. As a side effect, GNAT started
expanding packed operations on array types from their high-level
representations to operations operating on bits. It wasn't caught during
the original testing, but this actually confuses CodePeer. We thus need
to disable expansion of packed operations while in CodePeer_Mode.

gcc/ada/

* exp_pakd.adb (Expand_Bit_Packed_Element_Set): Disable expansion
in CodePeerMode.
(Expand_Packed_Address_Reference): Likewise.
(Expand_Packed_Bit_Reference): Likewise.
(Expand_Packed_Boolean_Operator): Likewise.
(Expand_Packed_Element_Reference): Likewise.
(Expand_Packed_Eq): Likewise.
(Expand_Packed_Not): Likewise.

gcc/ada/exp_pakd.adb

index 59dfe5df8df4fa3db422a28eea3f77c30383aa36..00bf60ae40677858320f70d542cd010e3ffe969d 100644 (file)
@@ -1121,6 +1121,10 @@ package body Exp_Pakd is
    begin
       pragma Assert (Is_Bit_Packed_Array (Etype (Prefix (Lhs))));
 
+      if CodePeer_Mode then
+         return;
+      end if;
+
       Obj := Relocate_Node (Prefix (Lhs));
       Convert_To_Actual_Subtype (Obj);
       Atyp := Etype (Obj);
@@ -1507,6 +1511,11 @@ package body Exp_Pakd is
       Offset : Node_Id;
 
    begin
+
+      if CodePeer_Mode then
+         return;
+      end if;
+
       --  We build an expression that has the form
 
       --    outer_object'Address
@@ -1546,6 +1555,11 @@ package body Exp_Pakd is
       Offset : Node_Id;
 
    begin
+
+      if CodePeer_Mode then
+         return;
+      end if;
+
       --  We build an expression that has the form
 
       --    (linear-subscript * component_size      for each array reference
@@ -1581,6 +1595,11 @@ package body Exp_Pakd is
       PAT  : Entity_Id;
 
    begin
+
+      if CodePeer_Mode then
+         return;
+      end if;
+
       Convert_To_Actual_Subtype (L);
       Convert_To_Actual_Subtype (R);
 
@@ -1744,6 +1763,11 @@ package body Exp_Pakd is
       Arg   : Node_Id;
 
    begin
+
+      if CodePeer_Mode then
+         return;
+      end if;
+
       --  If the node is an actual in a call, the prefix has not been fully
       --  expanded, to account for the additional expansion for in-out actuals
       --  (see expand_actuals for details). If the prefix itself is a packed
@@ -1907,6 +1931,11 @@ package body Exp_Pakd is
       PAT  : Entity_Id;
 
    begin
+
+      if CodePeer_Mode then
+         return;
+      end if;
+
       Convert_To_Actual_Subtype (L);
       Convert_To_Actual_Subtype (R);
       Ltyp := Underlying_Type (Etype (L));
@@ -2004,6 +2033,11 @@ package body Exp_Pakd is
       Size : Unat;
 
    begin
+
+      if CodePeer_Mode then
+         return;
+      end if;
+
       Convert_To_Actual_Subtype (Opnd);
       Rtyp := Etype (Opnd);
 
This page took 0.065804 seconds and 5 git commands to generate.