From: Bill Schmidt Date: Wed, 7 Dec 2016 01:08:40 +0000 (+0000) Subject: backport: re PR tree-optimization/78646 (incorrect result type for pointer addition... X-Git-Tag: releases/gcc-5.5.0~660 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=95e947ba58c53daad550c2c52c22d6d11b34cb27;p=thirdparty%2Fgcc.git backport: re PR tree-optimization/78646 (incorrect result type for pointer addition in slsr) 2016-12-06 Bill Schmidt Backport from mainline 2016-12-05 Bill Schmidt Stefan Freudenberger PR tree-optimization/78646 * gimple-ssa-strength-reduction.c (replace_ref): The pointer addition used for the memory base expression should have the type of the candidate. From-SVN: r243331 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 382004e3e253..7a2498e3dedf 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,14 @@ +2016-12-06 Bill Schmidt + + Backport from mainline + 2016-12-05 Bill Schmidt + Stefan Freudenberger + + PR tree-optimization/78646 + * gimple-ssa-strength-reduction.c (replace_ref): The pointer + addition used for the memory base expression should have the type + of the candidate. + 2016-12-02 Kyrylo Tkachov Backport from mainline diff --git a/gcc/gimple-ssa-strength-reduction.c b/gcc/gimple-ssa-strength-reduction.c index b9598a127d6d..4c4610e28d01 100644 --- a/gcc/gimple-ssa-strength-reduction.c +++ b/gcc/gimple-ssa-strength-reduction.c @@ -1918,7 +1918,7 @@ replace_ref (tree *expr, slsr_cand_t c) if (align < TYPE_ALIGN (acc_type)) acc_type = build_aligned_type (acc_type, align); - add_expr = fold_build2 (POINTER_PLUS_EXPR, TREE_TYPE (c->base_expr), + add_expr = fold_build2 (POINTER_PLUS_EXPR, c->cand_type, c->base_expr, c->stride); mem_ref = fold_build2 (MEM_REF, acc_type, add_expr, wide_int_to_tree (c->cand_type, c->index));