From 42fd8154a43a0c62c64f87b2d248fa73615071b9 Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Wed, 27 Aug 2008 09:03:14 +0000 Subject: [PATCH] Repair semantics of !: Result type is int, not the operand type. [r21494] --- parser.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/parser.c b/parser.c index 07f1141..c26ca18 100644 --- a/parser.c +++ b/parser.c @@ -6986,7 +6986,7 @@ static void semantic_unexpr_arithmetic(unary_expression_t *expression) expression->base.type = orig_type; } -static void semantic_unexpr_scalar(unary_expression_t *expression) +static void semantic_not(unary_expression_t *expression) { type_t *const orig_type = expression->value->base.type; type_t *const type = skip_typeref(orig_type); @@ -6997,7 +6997,7 @@ static void semantic_unexpr_scalar(unary_expression_t *expression) return; } - expression->base.type = orig_type; + expression->base.type = type_int; } static void semantic_unexpr_integer(unary_expression_t *expression) @@ -7086,7 +7086,7 @@ CREATE_UNARY_EXPRESSION_PARSER('-', EXPR_UNARY_NEGATE, CREATE_UNARY_EXPRESSION_PARSER('+', EXPR_UNARY_PLUS, semantic_unexpr_arithmetic) CREATE_UNARY_EXPRESSION_PARSER('!', EXPR_UNARY_NOT, - semantic_unexpr_scalar) + semantic_not) CREATE_UNARY_EXPRESSION_PARSER('*', EXPR_UNARY_DEREFERENCE, semantic_dereference) CREATE_UNARY_EXPRESSION_PARSER('&', EXPR_UNARY_TAKE_ADDRESS, -- 2.20.1