aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
-rw-r--r--linearize.c13
-rw-r--r--symbol.h1
2 files changed, 12 insertions, 2 deletions
diff --git a/linearize.c b/linearize.c
index 0250c6bb..e80715ab 100644
--- a/linearize.c
+++ b/linearize.c
@@ -977,8 +977,17 @@ static struct symbol *bitfield_base_type(struct symbol *sym)
if (sym) {
if (sym->type == SYM_NODE)
base = base->ctype.base_type;
- if (base->type == SYM_BITFIELD)
- return base->ctype.base_type;
+ if (base->type == SYM_BITFIELD) {
+ base = base->ctype.base_type;
+ if (sym->packed) {
+ int size = bits_to_bytes(sym->bit_offset + sym->bit_size);
+ sym = __alloc_symbol(0);
+ *sym = *base;
+ sym->bit_size = bytes_to_bits(size);
+ return sym;
+ }
+ return base;
+ }
}
return sym;
}
diff --git a/symbol.h b/symbol.h
index 5c5a7f12..866d5752 100644
--- a/symbol.h
+++ b/symbol.h
@@ -192,6 +192,7 @@ struct symbol {
accessed:1,
builtin:1,
torename:1,
+ packed:1,
transparent_union:1;
int rank:3; // arithmetic's rank
struct expression *array_size;