History

Catch array[index] with unknown sizeof(*array)

We could support this for index == 0, but GCC doesn't bother, so why should we?

Daniel Glöckner committed 16 years ago

Commit 4d05a631 parent 95b9a471 file · +5 −2Browse files

Unified · Split

tccgen.c+5−2
@@ -1548,11 +1548,14 @@ ST_FUNC void gen_op(int op) · 1547 unmodified lines
15481548 }
15491549 type1 = vtop[-1].type;
15501550 type1.t &= ~VT_ARRAY;
1551+ u = pointed_size(&vtop[-1].type);
1552+ if (u < 0)
1553+ error("unknown array element size");
15511554 #ifdef TCC_TARGET_X86_64
1552− vpushll(pointed_size(&vtop[-1].type));
1555+ vpushll(u);
15531556 #else
15541557 /* XXX: cast to int ? (long long case) */
1555− vpushi(pointed_size(&vtop[-1].type));
1558+ vpushi(u);
15561559 #endif
15571560 gen_op('*');
15581561 #ifdef CONFIG_TCC_BCHECK

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