ast2firm: Evaluate the operand of a void cast for its side effects again.
authorChristoph Mallon <christoph.mallon@gmx.de>
Thu, 27 Dec 2012 08:28:45 +0000 (09:28 +0100)
committerChristoph Mallon <christoph.mallon@gmx.de>
Thu, 27 Dec 2012 08:35:19 +0000 (09:35 +0100)
ast2firm.c

index 3cc2db0..ada6300 100644 (file)
@@ -2204,15 +2204,15 @@ static ir_node *handle_assume(expression_t const *const expr)
 
 static ir_node *create_cast(unary_expression_t const *const expr)
 {
-       type_t *const type = skip_typeref(expr->base.type);
-       if (is_type_void(type))
-               return NULL;
-
        type_t  *const from_type = skip_typeref(expr->value->base.type);
        ir_node       *value     = is_type_complex(from_type)
                ? expression_to_complex(expr->value).real
                : expression_to_value(expr->value);
 
+       type_t *const type = skip_typeref(expr->base.type);
+       if (is_type_void(type))
+               return NULL;
+
        dbg_info *const dbgi = get_dbg_info(&expr->base.pos);
        ir_mode  *const mode = get_ir_mode_storage(type);
        /* check for conversion from / to __based types */