aboutsummaryrefslogtreecommitdiff
path: root/tccgen.c
diff options
context:
space:
mode:
authorDaniel Glöckner <daniel-gl@gmx.net>2010-03-15 22:37:41 +0100
committerDaniel Glöckner <daniel-gl@gmx.net>2010-03-15 22:51:19 +0100
commit4d05a6319d07b5a686083043b69643a5550c2eeb (patch)
tree62d938ff8c8e1cfc15b707a209643ab8f87e3d83 /tccgen.c
parent95b9a477b6743004e0e9bf728b25bf63d2908777 (diff)
downloadtinycc-4d05a6319d07b5a686083043b69643a5550c2eeb.tar.gz
tinycc-4d05a6319d07b5a686083043b69643a5550c2eeb.tar.bz2
Catch array[index] with unknown sizeof(*array)
We could support this for index == 0, but GCC doesn't bother, so why should we?
Diffstat (limited to 'tccgen.c')
-rw-r--r--tccgen.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/tccgen.c b/tccgen.c
index 805410b..f1fe1ee 100644
--- a/tccgen.c
+++ b/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