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]

[Ada] Set the mode of the record type crafted by make_aligning_type


gigi's 'make_aligning_types' for Ada constructs a very special record
type to handle objects overaligned compared to what the underlying
allocation services offer (for instance, a 16bytes aligned object
dynamically allocated on a target where the system allocator honors at
most 8).

As the new comment from make_aligning_type says

  /*        [...]                          We exceptionally do everything
     manually here because 1) our generic circuitry is not quite ready to
     handle the complex position/size expressions we are setting up, 2) we
     have a strong simplifying factor at hand: we know the maximum possible
     value of voffset, and 3) we have to set/reset at least the sizes in
     accordance with this maximum value anyway, as we need them to convey
     what should be "alloc"ated for this type.

We were not setting the mode, with potential damages later on, such as
an internal compiler error on some targets for the testcase below:

   procedure Max_Align is
      type Block is record
	 X : Integer;
      end record;
      for Block'Alignment use Standard'Maximum_Alignment;

      type Block_Access is access Block;
      Ptr : Block_Access := new Block;
   begin
      null;
   end;

The attached patch just fixes that oversight.

Committing to mainline.

Olivier

2007-11-07  Olivier Hainque  <hainque@adacore.com>

	* decl.c (make_aligning_type): Set the mode of the RECORD_TYPE we
	craft and expand comment.

	testsuite/
	* gnat.dg/max_align.adb: New test.








Attachment: aligning-mode.dif
Description: Text document


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