From 5a044b67bba417f2d945c0831541cba83c204c05 Mon Sep 17 00:00:00 2001 From: Alexander Egorenkov Date: Mon, 2 Feb 2009 15:49:57 +0100 Subject: [PATCH] type_size function returned incorrect size of multi dimensional arrays if dimension is divisable by 2 --- tcc.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/tcc.c b/tcc.c index e7c6ca98..831ffd55 100644 --- a/tcc.c +++ b/tcc.c @@ -6229,8 +6229,15 @@ static int type_size(CType *type, int *a) return s->c; } else if (bt == VT_PTR) { if (type->t & VT_ARRAY) { + int ts; + 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 { *a = PTR_SIZE; return PTR_SIZE; -- 2.11.4.GIT