This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
PATCH: PR middle-end/48608: Alignment adjust of local variables is lost
- From: "H.J. Lu" <hongjiu dot lu at intel dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Thu, 14 Apr 2011 06:34:53 -0700
- Subject: PATCH: PR middle-end/48608: Alignment adjust of local variables is lost
- Reply-to: "H.J. Lu" <hjl dot tools at gmail dot com>
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;
}