From 9fd4a32dd13491d99fa4998fd3a0c471eb9c41cf Mon Sep 17 00:00:00 2001 From: Christoph Mallon Date: Thu, 4 Dec 2008 10:51:54 +0000 Subject: [PATCH] Convert the value before taking the shortcut in adjust_for_pointer_arithmetic(), so doing pointer arithmetic with char* and a long long offset works. PR: #0000008 [r24286] --- ast2firm.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ast2firm.c b/ast2firm.c index a9aac9c..9dd7023 100644 --- a/ast2firm.c +++ b/ast2firm.c @@ -2246,6 +2246,8 @@ static ir_node *adjust_for_pointer_arithmetic(dbg_info *dbgi, type_t *const points_to = skip_typeref(pointer_type->points_to); unsigned elem_size = get_type_size_const(points_to); + value = create_conv(dbgi, value, mode_int); + /* gcc extension: allow arithmetic with void * and function * */ if ((elem_size == 0 && is_type_atomic(points_to, ATOMIC_TYPE_VOID)) || is_type_function(points_to)) { @@ -2256,7 +2258,6 @@ static ir_node *adjust_for_pointer_arithmetic(dbg_info *dbgi, if (elem_size == 1) return value; - value = create_conv(dbgi, value, mode_int); ir_node *const cnst = new_Const_long(mode_int, (long)elem_size); ir_node *const mul = new_d_Mul(dbgi, value, cnst, mode_int); return mul; -- 2.20.1