Rasmus Lerdorf just tweeted that it's a gcc optimizer issue:
Works fine with -O0 but not -O2
http://twitter.com/rasmus/statuses/22212610308964353 Works fine with -O0 but not -O2
http://twitter.com/rasmus/statuses/22212610308964353(I haven't looked at this particular issue; maybe it really is a compiler bug. But the odds are against it.)
He also later added:
We still need to fix the code to make it immune to compiler switches.When you attempt to make an argument from authority, at least choose someone who has some credibility to use as an authority.
In other words, "We know that our code is buggy and it is relying on undefined behavior."
I.e., this developer knows it's a problem with his code, not the compiler, but he phrases it as if the "compiler switches" are the things causing the problems. This is classic developer arrogance and immaturity.
Thank God I don't rely on his software for anything important.