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]

[PATCH] Fix PR middle-end/28862, losing user alignment for vectors


The problem here is that relayout_decl forgot to take into account that
DECL_ALIGN could be set by the attribute aligned so we remove the
alignment for a decl which needed to be relayouted (like applying the
vector_size attribute to a decl).  As far as I can tell this is an
oversight of relayout_decl when it was added by Jason.  Jason added it
to relayout the decls when we change the type to a reference for a
PARM_DECL for the C++ front-end so I assume he had missed someone later
would use it for other cases like in the attribs.c after changing the
type when processing vector_size.
This patch fixes the problem by not zeroing the alignment when the user
set the alignment.

OK? Bootstrapped and tested on i686-linux-gnu with no regressions. 

:ADDPATCH middle-end (store-layout):

Thanks,
Andrew Pinski

ChangeLog:

	* stor-layout.c (relayout_decl): Don't zero the alignment if it
	was set by the user.
Index: stor-layout.c
===================================================================
--- stor-layout.c	(revision 116718)
+++ stor-layout.c	(working copy)
@@ -489,7 +489,8 @@ relayout_decl (tree decl)
 {
   DECL_SIZE (decl) = DECL_SIZE_UNIT (decl) = 0;
   DECL_MODE (decl) = VOIDmode;
-  DECL_ALIGN (decl) = 0;
+  if (!DECL_USER_ALIGN (decl))
+    DECL_ALIGN (decl) = 0;
   SET_DECL_RTL (decl, 0);
 
   layout_decl (decl, 0);

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