From: Eric Botcazou Date: Wed, 4 Jan 2012 21:37:11 +0000 (+0000) Subject: re PR tree-optimization/51624 (Assert_Failure atree.adb:808 during stage 3) X-Git-Tag: releases/gcc-4.6.3~203 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1140c0387eacda66e51fa2d29f3be3e679bd1533;p=thirdparty%2Fgcc.git re PR tree-optimization/51624 (Assert_Failure atree.adb:808 during stage 3) PR tree-optimization/51624 * tree-sra.c (build_ref_for_model): When replicating a chain of COMPONENT_REFs, stop as soon as the offset would become negative. From-SVN: r182890 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0b7afad9efde..c9a2654764b1 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2012-01-04 Eric Botcazou + + PR tree-optimization/51624 + * tree-sra.c (build_ref_for_model): When replicating a chain of + COMPONENT_REFs, stop as soon as the offset would become negative. + 2012-01-04 Richard Guenther PR tree-optimization/49651 diff --git a/gcc/tree-sra.c b/gcc/tree-sra.c index 756fe74bd525..016c0387d777 100644 --- a/gcc/tree-sra.c +++ b/gcc/tree-sra.c @@ -1472,8 +1472,14 @@ build_ref_for_model (location_t loc, tree base, HOST_WIDE_INT offset, do { tree field = TREE_OPERAND (expr, 1); - offset -= int_bit_position (field); + HOST_WIDE_INT bit_pos = int_bit_position (field); + /* We can be called with a model different from the one associated + with BASE so we need to avoid going up the chain too far. */ + if (offset - bit_pos < 0) + break; + + offset -= bit_pos; VEC_safe_push (tree, stack, cr_stack, expr); expr = TREE_OPERAND (expr, 0);