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
+2012-01-04 Eric Botcazou <ebotcazou@adacore.com>
+
+ 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 <rguenther@suse.de>
PR tree-optimization/49651
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);