Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
When you encounter problems like this, you should use tools like objdump (1) to examine the executed instructions. This would have revealed the function was optimized to an infinite loop. Be sure to do this when the code doesn't do what you thought it should.