aboutsummaryrefslogtreecommitdiff
path: root/tcc.c
diff options
context:
space:
mode:
authorAlexander Egorenkov <ae@linux-pc-2.(none)>2009-02-02 15:49:57 +0100
committergrischka <grischka>2009-04-18 15:07:08 +0200
commit5a044b67bba417f2d945c0831541cba83c204c05 (patch)
tree7ce0b9b3e6f88ac39dc01326f62706581fe34837 /tcc.c
parent64147b346b169d9a93c3ed5ba01b2b5f8b8db3b8 (diff)
downloadtinycc-5a044b67bba417f2d945c0831541cba83c204c05.tar.gz
tinycc-5a044b67bba417f2d945c0831541cba83c204c05.tar.bz2
type_size function returned incorrect size
of multi dimensional arrays if dimension is divisable by 2
Diffstat (limited to 'tcc.c')
-rw-r--r--tcc.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/tcc.c b/tcc.c
index e7c6ca9..831ffd5 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;