]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
decl.c (gnat_to_gnu_entity): If there is an alignment set on a renaming...
authorEric Botcazou <ebotcazou@adacore.com>
Sun, 11 Dec 2011 10:40:08 +0000 (10:40 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Sun, 11 Dec 2011 10:40:08 +0000 (10:40 +0000)
* gcc-interface/decl.c (gnat_to_gnu_entity) <object>: If there is an
alignment set on a renaming, assert that the renamed object is aligned
enough as to make it possible to honor it.

From-SVN: r182201

gcc/ada/ChangeLog
gcc/ada/gcc-interface/decl.c

index 495dbf45d1d578011ad92e68d262c0c2864611df..e8ce2e6902caa21a806ced51c6215deac8bc55d2 100644 (file)
@@ -1,3 +1,9 @@
+2011-12-11  Eric Botcazou  <ebotcazou@adacore.com>
+
+       * gcc-interface/decl.c (gnat_to_gnu_entity) <object>: If there is an
+       alignment set on a renaming, assert that the renamed object is aligned
+       enough as to make it possible to honor it.
+
 2011-12-11  Eric Botcazou  <ebotcazou@adacore.com>
 
        * gcc-interface/trans.c (gigi): Initialize the linemap earlier.
index 12971a63038d357b9d473b423144497ed9b221d5..aecbd76b9839b0500147906b99f7cd6675b46215 100644 (file)
@@ -1008,6 +1008,17 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, int definition)
                        saved = true;
                        annotate_object (gnat_entity, gnu_type, NULL_TREE,
                                         false, false);
+                       /* This assertion will fail if the renamed object
+                          isn't aligned enough as to make it possible to
+                          honor the alignment set on the renaming.  */
+                       if (align)
+                         {
+                           unsigned int renamed_align
+                             = DECL_P (gnu_decl)
+                               ? DECL_ALIGN (gnu_decl)
+                               : TYPE_ALIGN (TREE_TYPE (gnu_decl));
+                           gcc_assert (renamed_align >= align);
+                         }
                        break;
                      }