diff options
| author | Michael Matz <matz@suse.de> | 2017-05-05 23:16:43 +0200 |
|---|---|---|
| committer | Michael Matz <matz@suse.de> | 2017-05-05 23:16:43 +0200 |
| commit | 075723456073bf7319805ce964a3f8a036eb7d27 (patch) | |
| tree | 2b11d19601d7fa75a00aed83d5f2c865d45c2f8c /tccgen.c | |
| parent | a7a3627ab2f9f06e7725c6b6c796984684d0fdb8 (diff) | |
| download | tinycc-075723456073bf7319805ce964a3f8a036eb7d27.tar.gz tinycc-075723456073bf7319805ce964a3f8a036eb7d27.tar.bz2 | |
Fix unsigned enum bit-fields
See testcase. If an enum has only positive values, fits N bits,
and is placed in a N-bit bit-field that bit-fields must be treated
as unsigned, not signed.
Diffstat (limited to 'tccgen.c')
| -rw-r--r-- | tccgen.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -1082,7 +1082,9 @@ ST_FUNC int gv(int rc) } else type.t = VT_INT; if((vtop->type.t & VT_UNSIGNED) || - (vtop->type.t & VT_BTYPE) == VT_BOOL) + (vtop->type.t & VT_BTYPE) == VT_BOOL || + (((vtop->type.t & VT_BTYPE) == VT_ENUM) && + vtop->type.ref->a.unsigned_enum)) type.t |= VT_UNSIGNED; gen_cast(&type); /* generate shifts */ |
