I was looking to see what needs to be done to un-stick this previously submitted patch:

http://gcc.gnu.org/ml/gcc-patches/2012-05/msg01419.html

Paolo's suggestion was to re-write this to use a "tortoise-and-hare" algorithm to detect the circularity, rather than Andrew's solution of using a pointer_set to keep track of already-visited states.

Having spent a couple hours scratching my head over how to do the suggested re-write, I'm thinking that Andrew's proposed patch is really the better solution after all. This isn't a linked list we're traversing, it's an iterative computation, so doing the tortoise-and-hare thing either requires a lot of extra recomputation even in the normal case where it terminates quickly, or building some data structures to track already-visited states. And, if we're going to build data structures, why not use ones we already have a convenient library for? What else are such libraries for but to consolidate common code and make it easier to express such idioms? IMO, that's a lighter-weight solution than further complicating this code, and I feel much more confident that it'll squash an entire class of lurking bugs without introducing new ones.

Paolo, will you reconsider this?  Anyone else care to join the fray?

-Sandra

Reply via email to