On Mon, Dec 12, 2011 at 6:53 PM, Sandra Loosemore
<san...@codesourcery.com> wrote:
> The test case in the attached patch gets stuck in an infinite loop in
> find_comparison_args in CSE when compiled for MIPS at -O2.  This bug has
> been present at least as far back as GCC 4.5 and probably much earlier than
> that.
>
> The problem is that the inner loop over equivalences in the hash table is
> finding something that rewrites to exactly the same expression that we've
> already got in the outer loop, and there is no test for circular rewrites.
>
> This patch fixes the specific problem in the test case by skipping over
> equivalences that would rewrite to exactly the same expression as on the
> current iteration.  But, it's not clear that there can't also be cycles of
> length > 1.  I don't see much point in getting fancy here (I assume that if
> this were a common problem it would have been reported and fixed long before
> now) so I just added a simple limit on the number of iterations to be sure
> the outer loop always terminates.
>
> I regression-tested this in a GCC 4.5-based build for mips-linux-gnu and
> also did a full bootstrap and regression test for i686-pc-linux-gnu on
> mainline head.  OK to check in on mainline?

This is http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50380 .

Thanks,
Andrew Pinski

Reply via email to