]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR tree-optimization/51624 (Assert_Failure atree.adb:808 during stage 3)
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 4 Jan 2012 21:37:11 +0000 (21:37 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Wed, 4 Jan 2012 21:37:11 +0000 (21:37 +0000)
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

gcc/ChangeLog
gcc/tree-sra.c

index 0b7afad9efde1c42f7fb65eada4e9bac8518f5ab..c9a2654764b1a1dd747f08569014abe5583c87f2 100644 (file)
@@ -1,3 +1,9 @@
+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
index 756fe74bd52555359f859b1ccc48738ec9818700..016c0387d7773fc64eec29d36488b089671b295a 100644 (file)
@@ -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);