[PATCH] Detect loops in find_comparison_args

Andrew Jenner andrew@codesourcery.com
Mon May 21 17:21:00 GMT 2012


Hi Paolo,

On 5/21/2012 10:12 AM, Paolo Bonzini wrote:
> That's pretty heavy-weight.  Perhaps you can try the usual algorithm of
> looking at x->next and x->next->next?

That would only detect cycles of length 1 and 2 though. While that would 
cover all the testcases we currently know about, I wanted to eliminate 
the entire pattern of hangs. Otherwise it's only a question of time 
until someone hits a cycle of length >= 3.

We could use less memory at the expense of CPU time by using the 
tortoise and hare algorithm, but that would make the code much more 
complicated.

Andrew



More information about the Gcc-patches mailing list