Re:The Following Code Causes Segfault in Clang
by danieljh on Saturday August 02, 2014 @07:21PM
(#8126391)
You are right in that the return is wrong and accidentally stayed in during example reduction down to a smaller version. Without it, the result is still the same.
The reason I was testing this was a discussion on IRC about functions decaying to pointer to functions, such that they are endlessly dereferenceable. The snippet above crashes GCC -- hard.
So, while the implementation is free not to handle 10^7 dereferencing operations, I'm not sure a hard crash is the right answer.
Here's a version without the return and using a lambda to shorten it further:
The reason I was testing this was a discussion on IRC about functions decaying to pointer to functions, such that they are endlessly dereferenceable. The snippet above crashes GCC -- hard.
So, while the implementation is free not to handle 10^7 dereferencing operations, I'm not sure a hard crash is the right answer.
Here's a version without the return and using a lambda to shorten it further: