Hi,
On Tuesday 08 December 2009, Vincent Rivière wrote:
Alan Hourihane wrote:
One of the easiest things to do is add -fno-strict-aliasing and see if
that helps. If that does it should be pretty easy to track down.
Exactly.
And if this not enough, all the -O options have to be removed. Most
compiler issues disappear when all the optimizations are turned off.
I wouldn't still call them issues in compiler... To be able to do
optimizations, compiler needs to be able to assume that the code
it's compiling is correct. If the code isn't correct, funny things can
happen after optimizations.
But the real cause is usually a hidden bug in the sources of the
problematic software. We can't exclude a compiler bug, too, but it is
more rare.
I think during well over ten years of programming C-code, I've seen only
couple of issue that were bugs in GCC code generation and not in the
compiled C-code and those have been associated with support for some
new architecture / instruction set in it.
GCC C++ side has AFAIK had more issues, but I don't really code C++,
so I've been saved from those. GCC can also sometimes terminate to
an ICE i.e. internal compiler error, but those don't generate bad code
and are also exceedingly rare.
- Eero