[LLVMdev] infinite looping on hashtables

John McCall rjmccall at apple.com
Tue Apr 28 17:08:23 PDT 2009


On Apr 28, 2009, at 4:15 PM, Stuart Hastings wrote:
> I think this is abusing DenseSet.h, but the bug report says it used to
> work...

I never claimed any such thing. :)

This did come up in a real situation where I know the size of a  
particular set.  The set can get large enough to justify giving size  
advice to the implementation, but it can also be quite small, which  
triggered this bug.  2 is not an a priori unreasonable initial size to  
give to a hashtable (although I should've been scaling the size  
upwards to prevent excess collisions anyway).

> Question:  How can I test this?  I was able to create a nifty
> Googletest unit test:

> This test works fine, so long as it passes.  If the observed failure
> happens, it hangs at the set.count(2) call, and the Googletest
> framework apparently doesn't catch hangs.  (At least, it didn't wake
> up after twenty minutes.)

Unfortunately, it looks like the current Googletest framework doesn't  
support test timeouts or anything like them.  You could probably hack  
it by creating a thread to sleep() for five seconds and then kill the  
current process, but ugh.

John.



More information about the llvm-dev mailing list