https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65735
--- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- Created attachment 35300 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=35300&action=edit gcc5-pr65735.patch Untested fix. It seems there is a guard against recursion, but it only checks that we don't recurse through the same PHI more than once. But e.g. on the bb5 in the testcase there are two different PHI nodes, and we walk one of the PHI nodes first and then walk the other PHI node the second time, which is when we add the same basic block to the path again. At least short term, I don't think the paths with loops in them are really supportable. Tested so far just on the new testcase and on tree-ssa.exp=*dom*, will do full bootstrap/regtest momentarily.