This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH: fix infinite loop in CSE


On Mon, Dec 12, 2011 at 6:53 PM, Sandra Loosemore
<sandra@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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]