This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/48124] [4.3/4.4/4.5/4.6/4.7 Regression] likely wrong code bug
- From: "aldyh at redhat dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 15 Mar 2011 12:42:59 +0000
- Subject: [Bug middle-end/48124] [4.3/4.4/4.5/4.6/4.7 Regression] likely wrong code bug
- Auto-submitted: auto-generated
- References: <bug-48124-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48124
--- Comment #5 from Aldy Hernandez <aldyh at redhat dot com> 2011-03-15 12:42:36 UTC ---
> struct S
> {
> signed a : 26;
> signed b : 16;
> signed c : 10;
> volatile signed d : 14;
> int e;
> } s;
> I think you can't just modify s.e when writing s.d (I think it is fine to
> modify
> adjacent bitfields though, Aldy?).
No, you can't modify s.e when writing to s.d. However, you can modify
adjacent bitfields. All contiguous bitfields can be considered a single
memory location for the purpose of introducing data races. The only
exception is when bitfields are separated by a zero-length bitfield, or
when they happen to be contiguous but occur in different
structures/unions. Those conditions force alignments on those fields.