diff options
| author | Michael Matz <matz@suse.de> | 2017-05-01 06:18:48 +0200 |
|---|---|---|
| committer | Michael Matz <matz@suse.de> | 2017-05-01 06:18:48 +0200 |
| commit | 8d9dd3c0088d69d7742889c3267e5b1a138641b0 (patch) | |
| tree | d29666fc313261ccb106b98f01c7a868a363d4c5 /tccgen.c | |
| parent | 4ce73354fc5e555934bc721e2ab53936df6628e0 (diff) | |
| download | tinycc-8d9dd3c0088d69d7742889c3267e5b1a138641b0.tar.gz tinycc-8d9dd3c0088d69d7742889c3267e5b1a138641b0.tar.bz2 | |
Fix more bitfield corner cases
Our code generation assumes that it can load/store with the
bit-fields base type, so bit_pos/bit_size must be in range for this.
We could change the fields type or adjust offset/bit_pos; we do the
latter.
Diffstat (limited to 'tccgen.c')
| -rw-r--r-- | tccgen.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -3391,6 +3391,9 @@ static void struct_layout(CType *type, AttributeDef *ad) (ofs2 / (typealign * 8)) > (size/typealign))) { c = (c + ((bit_pos + 7) >> 3) + typealign - 1) & -typealign; bit_pos = 0; + } else while (bit_pos + bit_size > size * 8) { + c += size; + bit_pos -= size * 8; } offset = c; /* In PCC layout named bit-fields influence the alignment |
