From: Christoph Mallon Date: Thu, 4 Dec 2008 10:51:54 +0000 (+0000) Subject: Convert the value before taking the shortcut in adjust_for_pointer_arithmetic(),... X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=9fd4a32dd13491d99fa4998fd3a0c471eb9c41cf;p=cparser 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] --- 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;