public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PATCH: PR middle-end/48608: Alignment adjust of local variables is lost
@ 2011-04-14 13:34 H.J. Lu
  2011-04-14 13:57 ` Richard Guenther
  0 siblings, 1 reply; 10+ messages in thread
From: H.J. Lu @ 2011-04-14 13:34 UTC (permalink / raw)
  To: gcc-patches

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;
 }
 

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-04-15 11:52 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-14 13:34 PATCH: PR middle-end/48608: Alignment adjust of local variables is lost H.J. Lu
2011-04-14 13:57 ` Richard Guenther
2011-04-14 14:01   ` H.J. Lu
2011-04-14 14:09     ` Richard Guenther
2011-04-14 14:27       ` H.J. Lu
2011-04-14 14:30         ` Richard Guenther
2011-04-14 15:26           ` Michael Matz
2011-04-14 15:48             ` H.J. Lu
2011-04-14 15:57               ` Richard Guenther
2011-04-15 12:34               ` Michael Matz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).