From 5bf9559e9e91fed9a8ab9d7d34d97eb94c7272ed Mon Sep 17 00:00:00 2001 From: bellard Date: Sat, 26 Jan 2002 19:13:31 +0000 Subject: [PATCH] bound check fix --- tcc.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tcc.c b/tcc.c index 520a62b..7516211 100644 --- a/tcc.c +++ b/tcc.c @@ -3101,7 +3101,9 @@ void gen_op(int op) /* XXX: cast to int ? (long long case) */ vpushi(pointed_size(vtop[-1].t)); gen_op('*'); - if (do_bounds_check) { + /* if evaluating constant expression, no code should be + generated, so no bound check */ + if (do_bounds_check && !const_wanted) { /* if bounded pointers, we generate a special code to test bounds */ if (op == '-') {