From 1ee60663bb9a6d3b5a5effb3028679928c77fa1a Mon Sep 17 00:00:00 2001 From: gingerBill Date: Tue, 14 Aug 2018 19:43:36 +0100 Subject: [PATCH] Fix issue #244 with constant array comparisons --- src/check_expr.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/check_expr.cpp b/src/check_expr.cpp index 9629a3e34..917e79dc7 100644 --- a/src/check_expr.cpp +++ b/src/check_expr.cpp @@ -1553,7 +1553,11 @@ void check_comparison(CheckerContext *c, Operand *x, Operand *y, TokenKind op) { } else { if (x->mode == Addressing_Constant && y->mode == Addressing_Constant) { - x->value = exact_value_bool(compare_exact_values(op, x->value, y->value)); + if (is_type_constant_type(x->type)) { + x->value = exact_value_bool(compare_exact_values(op, x->value, y->value)); + } else { + x->mode = Addressing_Value; + } } else { x->mode = Addressing_Value;