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 == '-') {