]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
2007-11-07 Olivier Hainque <hainque@adacore.com>
authorhainque <hainque@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 7 Nov 2007 09:51:46 +0000 (09:51 +0000)
committerhainque <hainque@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 7 Nov 2007 09:51:46 +0000 (09:51 +0000)
        * 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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@129958 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/ChangeLog
gcc/ada/decl.c
gcc/testsuite/ChangeLog
gcc/testsuite/gnat.dg/max_align.adb [new file with mode: 0644]

index f8eeac0fa0c6f1cc462f9deea699c29539009851..b3194787df5ab2ec26ab572a216fd58b93c8b88d 100644 (file)
@@ -1,3 +1,8 @@
+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.
+
 2007-11-01  Eric Botcazou  <ebotcazou@adacore.com>
 
        * lang-specs.h: Move translation of -fRTS= after -gnatez switch.
index 4a55947d4f73f18bc57464d2b13f7831736c2864..fdb39f2763018213963e096ce49ca2176830b037 100644 (file)
@@ -5144,10 +5144,13 @@ make_aligning_type (tree type, unsigned int align, tree size,
                             size_binop (PLUS_EXPR, room_st, voffset_st)),
                     bitsize_unit_node);
 
-  /* Craft the GCC record representation.  The sizes are set manually to
-     account for the maximum possible value of voffset, which avoids complex
-     self-references in the size expression and corresponds to what should be
-     "alloc"ated for this type anyway.
+  /* Craft the GCC record representation.  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.
 
      Use -1 as the 'addressable' indication for the field to prevent the
      creation of a bitfield.  We don't need one, it would have damaging
@@ -5171,6 +5174,8 @@ make_aligning_type (tree type, unsigned int align, tree size,
     = size_binop (PLUS_EXPR, size,
                  size_int (room + align / BITS_PER_UNIT));
 
+  TYPE_MODE (record_type) = BLKmode;
+
   copy_alias_set (record_type, type);
   return record_type;
 }
index f33553365b0618370e29d6d74831c41d3c070db9..62d9b2579e9c11e2da1e5c13bbec94fe1d22ad57 100644 (file)
@@ -1,3 +1,7 @@
+2007-11-07  Olivier Hainque  <hainque@adacore.com>
+
+       * gnat.dg/max_align.adb: New test.
+
 2007-11-06  H.J. Lu  <hongjiu.lu@intel.com>
 
        PR target/30961
diff --git a/gcc/testsuite/gnat.dg/max_align.adb b/gcc/testsuite/gnat.dg/max_align.adb
new file mode 100644 (file)
index 0000000..702bbac
--- /dev/null
@@ -0,0 +1,15 @@
+--  { dg-do compile }
+
+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;
+
+