cproc

Unnamed repository; edit this file 'description' to name the repository.
git clone git://git.nihaljere.xyz/cproc
Log | Files | Refs | Submodules | README | LICENSE

commit f0465801c10359224330c81bcdd857584e07634a
parent 1461f251570cb768122fc7ab2040b1d32366651e
Author: Michael Forney <mforney@mforney.org>
Date:   Tue,  4 Jun 2019 00:01:40 -0700

Fix non-adjacent bit-fields

Diffstat:
Mdecl.c | 1+
Atest/bitfield-non-adjacent.c | 3+++
Atest/bitfield-non-adjacent.qbe | 1+
3 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/decl.c b/decl.c @@ -709,6 +709,7 @@ addmember(struct structbuilder *b, struct qualtype mt, char *name, int align, ui if (t->size < mt.type->size) t->size = mt.type->size; } + b->bits = 0; } else { /* bit-field */ if (!(mt.type->prop & PROPINT)) error(&tok.loc, "bit-field has invalid type"); diff --git a/test/bitfield-non-adjacent.c b/test/bitfield-non-adjacent.c @@ -0,0 +1,3 @@ +struct { + int x : 1, y, z : 1; +} s = {.z = 1}; diff --git a/test/bitfield-non-adjacent.qbe b/test/bitfield-non-adjacent.qbe @@ -0,0 +1 @@ +export data $s = align 4 { z 8, b 1, z 3 }