This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix computation of offset_align


It always has to use the value that was actually used to align the field
whatever DECL_ALIGN is set to.  The Ada test case is below.

Tested on i686-pc-linux-gnu.

with PP1; use PP1;
with Objects; use Objects;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Command_Line; use Ada.Command_Line;
procedure PP is

   XX :  Natural := Natural'Value (Argument (1));

   VV : E2_Vector (1 .. 1) :=  (1 => E24);

   M : Num_Matrix (1 .. 0, 1 .. XX) := (others => (others => 0.0));

   R1 : R := (Root_Object with
                N1 => XX-1,
                N2 => XX,
                N3 => XX,
                AB => True,
                M  => M,
                V  => VV,
                N4 => 0
                );

begin
--   Put_Line ("VV(1) = " & VV (1)'Img);

   if R1.N4'Position = R1.V'Position then
      Put_Line ("NOT OK");
      Put_Line ("R1.N4 =" & R1.N4'Img);
      Put_Line ("R1.V(1) = " & R1.V(1)'Img);

      Put_Line ("R1.N4'Position =" & Integer'Image (R1.N4'Position));
      Put_Line ("R1.M'Position =" & Integer'Image (R1.M'Position));
      Put_Line ("R1.V'Position =" & Integer'Image (R1.V'Position));
   end if;

end PP;
with Objects; use Objects;

package PP1 is

   type E2 is (E21, E22, E23, E24);
   type E2_Vector is array (Positive range <>) of E2;

   type Num_Matrix is array (Positive range <>, Positive range <>) of Long_Float;

   type Root_Base is abstract new Root_Object with record
      AB : Boolean;
   end record;

   type R (N1, N2
             ,N3 
             , N4
             : Natural
          ) is new Root_Base with record
      M : Num_Matrix (1 .. N1, 1 .. N2);
      V : E2_Vector (1 .. N3);
   end record;

end PP1;
with Ada.Finalization;

package Objects is

   type Root_Object is new Ada.Finalization.Controlled with private;


private

   type Root_Object is new Ada.Finalization.Controlled with record
      Reference_Count : Natural := 0;
   end record;

end Objects;

Wed Mar 19 15:19:12 2003  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>

	* stor-layout.c (place_field): When adjusting offset_align, use
	desired_align, not DECL_ALIGN.

*** gcc/stor-layout.c	29 Apr 2003 22:48:55 -0000	1.153
--- gcc/stor-layout.c	29 Apr 2003 22:52:54 -0000
*************** place_field (rli, field)
*** 1237,1241 ****
  	= size_binop (PLUS_EXPR, rli->offset, DECL_SIZE_UNIT (field));
        rli->bitpos = bitsize_zero_node;
!       rli->offset_align = MIN (rli->offset_align, DECL_ALIGN (field));
      }
    else
--- 1237,1241 ----
  	= size_binop (PLUS_EXPR, rli->offset, DECL_SIZE_UNIT (field));
        rli->bitpos = bitsize_zero_node;
!       rli->offset_align = MIN (rli->offset_align, desired_align);
      }
    else


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]