mirror of
https://github.com/mirror/tinycc.git
synced 2025-03-28 12:10:05 +08:00
tccgen.c: off by one in flexible array members
tccgen.c: fix fexible array member breaking struct alignment
This commit is contained in:
parent
f75f89fc8f
commit
7e0ad4fdd2
2
tccgen.c
2
tccgen.c
@ -5847,7 +5847,7 @@ static void decl_initializer_alloc(CType *type, AttributeDef *ad, int r,
|
||||
tcc_error("unknown type size");
|
||||
}
|
||||
if (flexible_array)
|
||||
size += flexible_array->type.ref->c * pointed_size(&flexible_array->type);
|
||||
size += flexible_array->type.ref->c * pointed_size(&flexible_array->type) + 1;
|
||||
/* take into account specified alignment if bigger */
|
||||
if (ad->a.aligned) {
|
||||
if (ad->a.aligned > align)
|
||||
|
Loading…
Reference in New Issue
Block a user