[rescue] Why gcc exists - Re: Help with SunFire V240 Server
mroos at linux.ee
Fri Apr 12 01:43:32 CDT 2013
> gcc really likes to be helpful and optimize for you. We've found that
> sometimes, it'll optimize out entire loops and function calls, whether we
> wanted them executed or not!
I have had many occasions where new gcc optimizes something that old one
would not and where gcc seems to be buggy at first. Back when I was a
student, on first couple of times I thought it was the compiler at
fault. But it was always my code.
Later I have learned that there is really not much point in blaming
comiler for bugs before the resulting code has been disassembled and
analyzed. So far, it has always been the code to compiled that was
faulty. Insufficient clobbers around inline asm blocks, re-using va_list
implictly (happened to work by luck on 32-bit, failed on 64-bit) etc.
Last funny one was http://blog.regehr.org/archives/918 where old bug
came out with newest optimizations.
Yes, of course I have seen real bug reports about gcc in the Internet.
But my experience is that usually the code is wrong and the bugs only
come out when trying harder to optimize it.
Meelis Roos (mroos at linux.ee)
More information about the rescue