diff options
| author | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2021-01-01 22:21:46 +0100 |
|---|---|---|
| committer | Luc Van Oostenryck <luc.vanoostenryck@gmail.com> | 2021-01-01 22:21:46 +0100 |
| commit | fe455dd6b9fb47743271f342691c4b68532f1260 (patch) | |
| tree | 44e21912adf82caa03e11214fc682bbe460e1b16 /linearize.c | |
| parent | 10283ac0f48df99e02a5cb16a423972ae42de00d (diff) | |
| parent | 2cf493d1f63f075e6fe0cccbcb7463b1aa773a74 (diff) | |
| download | sparse-dev-fe455dd6b9fb47743271f342691c4b68532f1260.tar.gz | |
Merge branch 'packed'
* packed: add support for __packed struct
Diffstat (limited to 'linearize.c')
| -rw-r--r-- | linearize.c | 13 |
1 files changed, 11 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; } |
