diff options
| author | Alexander Egorenkov <ae@linux-pc-2.(none)> | 2009-02-02 15:49:57 +0100 |
|---|---|---|
| committer | grischka <grischka> | 2009-04-18 15:07:08 +0200 |
| commit | 5a044b67bba417f2d945c0831541cba83c204c05 (patch) | |
| tree | 7ce0b9b3e6f88ac39dc01326f62706581fe34837 | |
| parent | 64147b346b169d9a93c3ed5ba01b2b5f8b8db3b8 (diff) | |
| download | tinycc-5a044b67bba417f2d945c0831541cba83c204c05.tar.gz tinycc-5a044b67bba417f2d945c0831541cba83c204c05.tar.bz2 | |
type_size function returned incorrect size
of multi dimensional arrays if dimension is divisable by 2
| -rw-r--r-- | tcc.c | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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; |
