aboutsummaryrefslogtreecommitdiff
path: root/gcc/stor-layout.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2008-02-25 09:55:26 +0000
committerEric Botcazou <ebotcazou@gcc.gnu.org>2008-02-25 09:55:26 +0000
commitd4cba6d4428b397b7fd4e0d602f1d076ee363aea (patch)
tree6370b29061600d79c54493687748d4db7efd7c4d /gcc/stor-layout.c
parent9dd39a15b8fa97cd3290d27e88dc284bf782082e (diff)
downloadgcc-d4cba6d4428b397b7fd4e0d602f1d076ee363aea.zip
gcc-d4cba6d4428b397b7fd4e0d602f1d076ee363aea.tar.gz
gcc-d4cba6d4428b397b7fd4e0d602f1d076ee363aea.tar.bz2
stor-layout.c (layout_decl): Do not bump the alignment of a bit-field to more than byte alignment if...
* stor-layout.c (layout_decl): Do not bump the alignment of a bit-field to more than byte alignment if it is packed. From-SVN: r132614
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 1ae2db5..a7bcd05 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;
}