As suggested by Robert, it would be valuable to have an assertion in gigi to 
detect conflicting alignments in renaming, i.e. when an alignment value set on 
the renaming cannot be honored because the renamed object isn't sufficiently 
aligned.

Tested on i586-suse-linux, applied on the mainline.


2011-12-11  Eric Botcazou  <ebotca...@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.


-- 
Eric Botcazou
Index: gcc-interface/decl.c
===================================================================
--- gcc-interface/decl.c	(revision 182102)
+++ gcc-interface/decl.c	(working copy)
@@ -1008,6 +1008,17 @@ gnat_to_gnu_entity (Entity_Id gnat_entit
 			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;
 		      }
 

Reply via email to