From c2eaf30f140b751253727116d2b123826c02c70c Mon Sep 17 00:00:00 2001 From: Matthias Braun Date: Sat, 13 Dec 2008 20:42:43 +0000 Subject: [PATCH] fix subtle implicit cast problem [r24627] --- ast2firm.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/ast2firm.c b/ast2firm.c index c989f72..817c990 100644 --- a/ast2firm.c +++ b/ast2firm.c @@ -2242,12 +2242,11 @@ static ir_node *unary_expression_to_firm(const unary_expression_t *expression) case EXPR_UNARY_CAST: { ir_node *value_node = expression_to_firm(value); if (is_type_scalar(type)) { - ir_mode *mode = get_ir_mode_storage(type); - ir_node *node = create_conv(dbgi, value_node, mode); - node = do_strict_conv(dbgi, node); - + ir_mode *mode = get_ir_mode_storage(type); + ir_node *node = create_conv(dbgi, value_node, mode); + node = do_strict_conv(dbgi, node); ir_mode *mode_arith = get_ir_mode_arithmetic(type); - node = create_conv(dbgi, node, mode_arith); + node = create_conv(dbgi, node, mode_arith); return node; } else { /* make sure firm type is constructed */ @@ -2258,8 +2257,11 @@ static ir_node *unary_expression_to_firm(const unary_expression_t *expression) case EXPR_UNARY_CAST_IMPLICIT: { ir_node *value_node = expression_to_firm(value); if (is_type_scalar(type)) { - ir_mode *mode = get_ir_mode_arithmetic(type); - return create_conv(dbgi, value_node, mode); + ir_mode *mode = get_ir_mode_storage(type); + ir_node *res = create_conv(dbgi, value_node, mode); + ir_mode *mode_arith = get_ir_mode_arithmetic(type); + res = create_conv(dbgi, res, mode_arith); + return res; } else { return value_node; } -- 2.20.1