[Bug c++/93209] New: What is a bitfield's "underlying type"?

2020-01-09 Thread John.Adriaan at BigPond dot com
Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: John.Adriaan at BigPond dot com Target Milestone: --- For the following, please assume: A. `sizeof(bool)` equals `1`; B. `sizeof(unsigned)` equals `4`; C. `-fstrict-volatile-bitfields` is ON; D. The compiler target

[Bug c++/93209] What is a bitfield's "underlying type"?

2020-01-09 Thread John.Adriaan at BigPond dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93209 --- Comment #1 from John Adriaan --- I've also looked at the `unsigned : 0;` anonymous field. Frankly, it changes nothing. Maybe it should? struct S { bool b : 1; unsigned i : 1; unsigned : 0; }; // S With

[Bug c++/93209] What is a bitfield's "underlying type"?

2020-01-09 Thread John.Adriaan at BigPond dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93209 --- Comment #2 from John Adriaan --- Wow: I just realised. The following code for my proposal is problematic: struct S { bool b : 1; unsigned i : 1; unsigned : 0; char c : 8; }; // S Should `c`

[Bug c++/93209] What is a bitfield's "underlying type"?

2020-01-09 Thread John.Adriaan at BigPond dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93209 --- Comment #4 from John Adriaan --- @RichardBiener, I used the different types to prove my point: if they're all `unsigned`, it still happens. And the ABI merely defines whether `-fstrict-volatile-bitfields` is the default or not (for ARM, it

[Bug c++/93209] What is a bitfield's "underlying type"?

2020-01-09 Thread John.Adriaan at BigPond dot com
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93209 --- Comment #5 from John Adriaan --- @RichardBiener, By "it still happens", I meant that accesses to `s.i` still occur as described. Changing `s.b` to be of type `unsigned` changes its accesses to match those of `s.i` - in other words, the type