History

type_size function returned incorrect size

of multi dimensional arrays if dimension is divisable by 2

Alexander Egorenkov committed 17 years ago

Commit 5a044b61 parent 64147b31 file · +8 −1Browse files

Unified · Split

tcc.c+8−1
@@ -6229,8 +6229,15 @@ static int type_size(CType *type, int *a) · 6228 unmodified lines
62296229 return s->c;
62306230 } else if (bt == VT_PTR) {
62316231 if (type->t & VT_ARRAY) {
6232+ int ts;
6233+
62326234 s = type->ref;
6233− return type_size(&s->type, a) * s->c;
6235+ ts = type_size(&s->type, a);
6236+
6237+ if (ts < 0 && s->c < 0)
6238+ ts = -ts;
6239+
6240+ return ts * s->c;
62346241 } else {
62356242 *a = PTR_SIZE;
62366243 return PTR_SIZE;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t