Hi,
On Fri, 28 Apr 2017, Vicente Bergas wrote:
For example the following does not work:
struct{short x:12; char y:1;}s; s.y=1;
Note that the above is tricky: char can be signed and unsigned if not
explicitely specified, and if it's signed then a 1-bit bitfield of char
only contains values -1 and 0, so storing a 1 into it actually makes the
value be -1. So depending on what you tested that might actually have
been the problem. (I.e. always specify signedness of char when using it
to store numeric values and not characters).
The attached patch improves bitfield handling.
Yeah, but the bitfield layout involving char fields was actually what was
broken. I've fixed that in mob making the above (with 'unsigned char')
and ...
There are still corner cases which are still failing, like:
struct{int x:31; char y:2;}s; s.y=1;
in which the char overflows the 32-bit type.
... this work. Thanks for the report.
Ciao,
Michael.
_______________________________________________
Tinycc-devel mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/tinycc-devel