]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
tree-ssa-reassoc.c (reassociate_bb): Properly reset the statement iterator after...
authorRichard Guenther <rguenther@suse.de>
Mon, 18 Aug 2008 15:36:15 +0000 (15:36 +0000)
committerRichard Biener <rguenth@gcc.gnu.org>
Mon, 18 Aug 2008 15:36:15 +0000 (15:36 +0000)
2008-08-18  Richard Guenther  <rguenther@suse.de>

* tree-ssa-reassoc.c (reassociate_bb): Properly reset the
statement iterator after statement removal.

From-SVN: r139201

gcc/ChangeLog
gcc/tree-ssa-reassoc.c

index 2f49559479ce6779fc6cffbc838365bfc683e372..38d137ff51db96e5b2d0699e05290d27bc203f7b 100644 (file)
@@ -1,3 +1,8 @@
+2008-08-18  Richard Guenther  <rguenther@suse.de>
+
+       * tree-ssa-reassoc.c (reassociate_bb): Properly reset the
+       statement iterator after statement removal.
+
 2008-08-18  Andreas Tobler  <a.tobler@schweiz.org>
 
        * config/rs6000/driver-rs6000.c (detect_caches_freebsd): New function.
index be68331faf2e40ea5f9bfa2400e22fc2cb2026b0..e4e7db69d2ea2dadfa1ff0126c77d20dcd1b3ab0 100644 (file)
@@ -1771,6 +1771,18 @@ reassociate_bb (basic_block bb)
                {
                  gsi_remove (&gsi, true);
                  release_defs (stmt);
+                 /* We might end up removing the last stmt above which
+                    places the iterator to the end of the sequence.
+                    Reset it to the last stmt in this case which might
+                    be the end of the sequence as well if we removed
+                    the last statement of the sequence.  In which case
+                    we need to bail out.  */
+                 if (gsi_end_p (gsi))
+                   {
+                     gsi = gsi_last_bb (bb);
+                     if (gsi_end_p (gsi))
+                       break;
+                   }
                }
              continue;
            }