summaryrefslogtreecommitdiff
path: root/gcc/stor-layout.c
diff options
context:
space:
mode:
authorebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2008-02-25 09:55:26 +0000
committerebotcazou <ebotcazou@138bc75d-0d04-0410-961f-82ee72b054a4>2008-02-25 09:55:26 +0000
commit23f6583561fe9b59d4bfb94768ae5cfd297c870b (patch)
tree6370b29061600d79c54493687748d4db7efd7c4d /gcc/stor-layout.c
parent54bc307a4916091d639dcc4771bcef4199a12fab (diff)
downloadgcc-23f6583561fe9b59d4bfb94768ae5cfd297c870b.tar.gz
* stor-layout.c (layout_decl): Do not bump the alignment of a
bit-field to more than byte alignment if it is packed. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@132614 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r--gcc/stor-layout.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 1ae2db5ca00..a7bcd054400 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -388,13 +388,13 @@ layout_decl (tree decl, unsigned int known_align)
{
enum machine_mode xmode
= mode_for_size_tree (DECL_SIZE (decl), MODE_INT, 1);
+ unsigned int xalign = GET_MODE_ALIGNMENT (xmode);
if (xmode != BLKmode
- && (known_align == 0
- || known_align >= GET_MODE_ALIGNMENT (xmode)))
+ && !(xalign > BITS_PER_UNIT && DECL_PACKED (decl))
+ && (known_align == 0 || known_align >= xalign))
{
- DECL_ALIGN (decl) = MAX (GET_MODE_ALIGNMENT (xmode),
- DECL_ALIGN (decl));
+ DECL_ALIGN (decl) = MAX (xalign, DECL_ALIGN (decl));
DECL_MODE (decl) = xmode;
DECL_BIT_FIELD (decl) = 0;
}