Passes do not expect post-dominators being around and thus forget to invalidate them properly. Thus passes computing them have to free them. The patch fixes path-isolation and adds an assert so this doesn't happen again.
Bootstrapped and tested on x86_64-unknown-linux-gnu, applied to trunk. Richard. 2015-07-08 Richard Biener <rguent...@suse.de> PR tree-optimization/66794 * passes.c (execute_function_todo): Assert that post-dominators are not computed. * gimple-ssa-isolate-paths.c (gimple_ssa_isolate_erroneous_paths): Free post-dominators. * gcc.dg/torture/pr66794.c: New testcase. Index: gcc/passes.c =================================================================== --- gcc/passes.c (revision 225534) +++ gcc/passes.c (working copy) @@ -1929,6 +1929,7 @@ execute_function_todo (function *fn, voi if (flags & TODO_rebuild_cgraph_edges) cgraph_edge::rebuild_edges (); + gcc_assert (dom_info_state (fn, CDI_POST_DOMINATORS) == DOM_NONE); /* If we've seen errors do not bother running any verifiers. */ if (!seen_error ()) { Index: gcc/gimple-ssa-isolate-paths.c =================================================================== --- gcc/gimple-ssa-isolate-paths.c (revision 225534) +++ gcc/gimple-ssa-isolate-paths.c (working copy) @@ -488,10 +488,10 @@ gimple_ssa_isolate_erroneous_paths (void /* We scramble the CFG and loop structures a bit, clean up appropriately. We really should incrementally update the loop structures, in theory it shouldn't be that hard. */ + free_dominance_info (CDI_POST_DOMINATORS); if (cfg_altered) { free_dominance_info (CDI_DOMINATORS); - free_dominance_info (CDI_POST_DOMINATORS); loops_state_set (LOOPS_NEED_FIXUP); return TODO_cleanup_cfg | TODO_update_ssa; } Index: gcc/testsuite/gcc.dg/torture/pr66794.c =================================================================== --- gcc/testsuite/gcc.dg/torture/pr66794.c (revision 0) +++ gcc/testsuite/gcc.dg/torture/pr66794.c (working copy) @@ -0,0 +1,22 @@ +/* { dg-do compile } */ +/* { dg-additional-options "-w" } */ + +int a, *b, e; +static int **c = &b; + +struct +{ + int f0; +} d; + +int * +fn1 () +{ + int f, **g = &b; + e = a; + for (; a;) + for (; d.f0; d.f0++) + ; + *g = &f; + return *c; +}