aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Matz <matz@suse.de>2017-05-08 19:58:31 +0200
committerMichael Matz <matz@suse.de>2017-05-08 19:58:31 +0200
commit377e8e5e68c52fe05bb33d87b4e29a7dd0db5f71 (patch)
tree76abc190e08c34c023f79a7d3f37b15268d3290e
parent1094891e67359058eb1c86a14d14ce24e233723a (diff)
downloadtinycc-377e8e5e68c52fe05bb33d87b4e29a7dd0db5f71.tar.gz
tinycc-377e8e5e68c52fe05bb33d87b4e29a7dd0db5f71.tar.bz2
bitfields: fix long bitfields
now the testcase works on i386-linux as well.
-rw-r--r--tccgen.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tccgen.c b/tccgen.c
index 76291eb..36c172a 100644
--- a/tccgen.c
+++ b/tccgen.c
@@ -3362,9 +3362,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;
+ } else if (bit_pos + bit_size > size * 8) {
+ c += bit_pos >> 3;
+ bit_pos &= 7;
}
offset = c;
/* In PCC layout named bit-fields influence the alignment