type_size function returned incorrect size
of multi dimensional arrays if dimension is divisable by 2
This commit is contained in:
parent
64147b346b
commit
5a044b67bb
1 changed files with 8 additions and 1 deletions
9
tcc.c
9
tcc.c
|
@ -6229,8 +6229,15 @@ static int type_size(CType *type, int *a)
|
||||||
return s->c;
|
return s->c;
|
||||||
} else if (bt == VT_PTR) {
|
} else if (bt == VT_PTR) {
|
||||||
if (type->t & VT_ARRAY) {
|
if (type->t & VT_ARRAY) {
|
||||||
|
int ts;
|
||||||
|
|
||||||
s = type->ref;
|
s = type->ref;
|
||||||
return type_size(&s->type, a) * s->c;
|
ts = type_size(&s->type, a);
|
||||||
|
|
||||||
|
if (ts < 0 && s->c < 0)
|
||||||
|
ts = -ts;
|
||||||
|
|
||||||
|
return ts * s->c;
|
||||||
} else {
|
} else {
|
||||||
*a = PTR_SIZE;
|
*a = PTR_SIZE;
|
||||||
return PTR_SIZE;
|
return PTR_SIZE;
|
||||||
|
|
Loading…
Reference in a new issue