mirror of
https://github.com/frida/tinycc
synced 2024-11-24 08:39:37 +03:00
Catch array[index] with unknown sizeof(*array)
We could support this for index == 0, but GCC doesn't bother, so why should we?
This commit is contained in:
parent
95b9a477b6
commit
4d05a6319d
7
tccgen.c
7
tccgen.c
@ -1548,11 +1548,14 @@ ST_FUNC void gen_op(int op)
|
||||
}
|
||||
type1 = vtop[-1].type;
|
||||
type1.t &= ~VT_ARRAY;
|
||||
u = pointed_size(&vtop[-1].type);
|
||||
if (u < 0)
|
||||
error("unknown array element size");
|
||||
#ifdef TCC_TARGET_X86_64
|
||||
vpushll(pointed_size(&vtop[-1].type));
|
||||
vpushll(u);
|
||||
#else
|
||||
/* XXX: cast to int ? (long long case) */
|
||||
vpushi(pointed_size(&vtop[-1].type));
|
||||
vpushi(u);
|
||||
#endif
|
||||
gen_op('*');
|
||||
#ifdef CONFIG_TCC_BCHECK
|
||||
|
Loading…
Reference in New Issue
Block a user