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: PR middle-end/48608: Alignment adjust of local variables is lost


We have

static unsigned int
get_decl_align_unit (tree decl)
{
  unsigned int align = LOCAL_DECL_ALIGNMENT (decl);
  return align / BITS_PER_UNIT;
}

LOCAL_DECL_ALIGNMENT may increase alignment for local variable.  But it is
never saved.  DECL_ALIGN (decl) returns the old alignment.  This patch
updates DECL_ALIGN if needed.  OK for trunk if there are no regressions?

Thanks.

H.J.
---
2011-04-14  H.J. Lu  <hongjiu.lu@intel.com>

	PR middle-end/48608
	* cfgexpand.c (get_decl_align_unit): Update DECL_ALIGN if needed.

diff --git a/gcc/cfgexpand.c b/gcc/cfgexpand.c
index cc1382f..e79d50c 100644
--- a/gcc/cfgexpand.c
+++ b/gcc/cfgexpand.c
@@ -212,6 +212,8 @@ static unsigned int
 get_decl_align_unit (tree decl)
 {
   unsigned int align = LOCAL_DECL_ALIGNMENT (decl);
+  if (align > DECL_ALIGN (decl))
+    DECL_ALIGN (decl) = align;
   return align / BITS_PER_UNIT;
 }
 


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