From 9c26d12f95bae7c4223dc601ed49f577ec267ae4 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 24 Feb 2020 02:13:23 +0900 Subject: [PATCH] Cast rather than alias for testing constants Fixes ICE in do { ... } while (1); --- tools/qfcc/source/expr_bool.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/tools/qfcc/source/expr_bool.c b/tools/qfcc/source/expr_bool.c index 6eda9aa8d..c460144b5 100644 --- a/tools/qfcc/source/expr_bool.c +++ b/tools/qfcc/source/expr_bool.c @@ -96,14 +96,22 @@ test_expr (expr_t *e) case ev_uinteger: case ev_integer: case ev_short: - if (type_default != &type_integer) + if (type_default != &type_integer) { + if (is_constant (e)) { + return cast_expr (type_default, e); + } return new_alias_expr (type_default, e); + } return e; case ev_float: if (options.code.fast_float || options.code.progsversion == PROG_ID_VERSION) { - if (type_default != &type_float) + if (type_default != &type_float) { + if (is_constant (e)) { + return cast_expr (type_default, e); + } return new_alias_expr (type_default, e); + } return e; } new = new_float_expr (0);