diff options
| author | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-14 18:43:27 +0000 |
|---|---|---|
| committer | jason <jason@138bc75d-0d04-0410-961f-82ee72b054a4> | 2003-10-14 18:43:27 +0000 |
| commit | c8b04847f2994147a41922219d7947381e18d3d4 (patch) | |
| tree | 6ce23fe6c27297992fbc3d02ada01154a587901a | |
| parent | c30dcdf99f3043aa775cb6e03d94abf22ac14d85 (diff) | |
| download | ppe42-gcc-c8b04847f2994147a41922219d7947381e18d3d4.tar.gz ppe42-gcc-c8b04847f2994147a41922219d7947381e18d3d4.zip | |
* stor-layout.c (do_type_align): New fn, split out from...
(layout_decl): ...here. Do all alignment calculations for
FIELD_DECLs here.
(update_alignment_for_field): Not here.
(start_record_layout, debug_rli): Remove unpadded_align.
* tree.h (struct record_layout_info_s): Remove unpadded_align.
* c-decl.c (finish_enum): Don't set DECL_SIZE, DECL_ALIGN
or DECL_MODE on the CONST_DECLs.
(finish_struct): Don't mess with DECL_ALIGN.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@72485 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/testsuite/gcc.dg/pack-test-4.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/pack-test-4.c b/gcc/testsuite/gcc.dg/pack-test-4.c new file mode 100644 index 00000000000..e0cfdf70451 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pack-test-4.c @@ -0,0 +1,32 @@ +// PR c/11885 +// Bug: flag4 was allocated into the same byte as the other flags. +// { dg-do run } + +typedef unsigned char uint8_t; + +typedef struct { + + uint8_t flag1:2; + uint8_t flag2:1; + uint8_t flag3:1; + + uint8_t flag4; + +} __attribute__ ((packed)) MyType; + +int main (void) +{ + MyType a; + MyType *b = &a; + + b->flag1 = 0; + b->flag2 = 0; + b->flag3 = 0; + + b->flag4 = 0; + + b->flag4++; + + if (b->flag1 != 0) + abort (); +} |

