Summary: | [3.3 Regression] Problem with bitfields in packed structs | ||
---|---|---|---|
Product: | gcc | Reporter: | Stan Rost <stanrost> |
Component: | c | Assignee: | Jason Merrill <jason> |
Status: | RESOLVED FIXED | ||
Severity: | critical | CC: | gcc-bugs, janis187, jason |
Priority: | P1 | Keywords: | wrong-code |
Version: | 3.3.1 | ||
Target Milestone: | 3.3.2 | ||
Host: | i686-pc-linux-gnu | Target: | i686-pc-linux-gnu avr-unknown-unknown |
Build: | Known to work: | ||
Known to fail: | Last reconfirmed: | 2003-08-11 21:14:39 |
Description
Stan Rost
2003-08-11 21:09:52 UTC
I can reproduce this in 3.3.1 (20030707). It is already fixed on the mainline and also in 3.2.3 so making this a regression. Can you try the patch in PR 11662? <http://gcc.gnu.org/bugzilla/attachment.cgi?id=4479&action=view> Just tried the patch, recompiled and reinstalled, but the patch you suggested did not fix the problem. Additionally, I double-checked everything so that the last sentence is not in error. Thanks for trying this patch, this helps us figure out which patch fixes this on the mainline. Janis, can you run your regression finder on this one as it looks like a bad regression (which is already fixed on the mainline) as prevents any one to use reserved fields in packed structors with bitfields. Subject: Re: [3.3 Regression] Problem with bitfields in packed structs This looked like an interesting bug so I started a hunt on the 3.3 branch a couple of hours ago, and it's now down to a single day (2003-03-31). When I identify where it broke on the branch I'll check to see if it was also broken on mainline, and then what fixed it on mainline. The regression in PR 11885 was introduced or exposed on the 3.3 branch and mainline by this patch: --- gcc/gcc/ChangeLog --- 2003-03-31 Jason Merrill <jason@redhat.com> * stor-layout.c (update_alignment_for_field): Respect DECL_USER_ALIGN for zero-length bitfields, too. * c-decl.c (finish_struct): Don't set DECL_ALIGN for normal fields. --- gcc/gcc/cp/ChangeLog --- 2003-03-31 Jason Merrill <jason@redhat.com> * class.c (check_field_decl): Don't set DECL_ALIGN. The test case passes for mainline after this large patch: --- gcc/gcc/ChangeLog --- 2003-04-03 Jason Merrill <jason@redhat.com> * 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. --- gcc/gcc/cp/ChangeLog --- 2003-04-03 Jason Merrill <jason@redhat.com> * class.c (build_vtable): Set DECL_ALIGN here. (get_vtable_decl): Not here. (layout_vtable_decl): Or here. (create_vtable_ptr): Or here. (layout_class_type): Or here. (check_bitfield_decl): Don't mess with field alignment. The hunts took place on i686-pc-linux-gnu using the submitter's test case. Subject: Bug 11885 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: jason@gcc.gnu.org 2003-10-14 18:43:09 Modified files: gcc : ChangeLog stor-layout.c Log message: PR c/11885 * stor-layout.c (update_alignment_for_field): Packed non-bit-fields get byte alignment. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.780&r2=1.16114.2.781 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/stor-layout.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.134.2.4&r2=1.134.2.5 Fixed for 3.3.2. |