From 5374798ef90147afa4abc12e43dcc1bf8d826664 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sun, 23 Feb 2020 23:18:31 +0900 Subject: [PATCH] Fix order of operations for implicit casts --- tools/qfcc/source/expr_binary.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tools/qfcc/source/expr_binary.c b/tools/qfcc/source/expr_binary.c index aad78dea5..a251860bf 100644 --- a/tools/qfcc/source/expr_binary.c +++ b/tools/qfcc/source/expr_binary.c @@ -956,9 +956,6 @@ binary_expr (int op, expr_t *e1, expr_t *e2) } } - et1 = low_level_type (t1); - et2 = low_level_type (t2); - if (is_constant (e1) && is_double (t1) && e1->implicit && is_float (t2)) { t1 = &type_float; convert_double (e1); @@ -968,6 +965,9 @@ binary_expr (int op, expr_t *e1, expr_t *e2) convert_double (e2); } + et1 = low_level_type (t1); + et2 = low_level_type (t2); + if (et1 >= ev_type_count || !binary_expr_types[et1]) return invalid_binary_expr(op, e1, e2); if (et2 >= ev_type_count || !binary_expr_types[et1][et2])