[gcc-4.4.5] wrong code, segfault in libtommath-0.42.0 with "-O2 -fgraphite-identity"

Ian Lance Taylor iant@google.com
Fri Jun 17 10:32:00 GMT 2011


Marcin Mirosław <marcin@mejor.pl> writes:

> W dniu 2011-06-16 18:30, Ian Lance Taylor pisze:
>> When a program crashes, it is normally a bug in the program, not a bug
>> in the compiler.  You should report this to libtommath.  Only report a
>> bug against gcc if you are convinced that the compiler is mishandling
>> valid code.
>
> Hi,
> thanks for the reply! I have to admit i'm still don't sure. Problem
> described earlier appears only with optimalization "-O2
> -fgraphite-identity", with e.g. "-O1 -fgraphite-identity" or "-O0
> -fgraphite-identity" i don't have such problem. So i've suspected
> problem with gcc.

Many programs crash at -O2 but not at -O1.  That is because -O2
implements more aggressive optimizations.  It does not mean that the
compiler is wrong.

Often the program will work if you use -fno-strict-aliasing
-fno-strict-overflow along with -O2.  If so, it still does not indicate
a compiler bug; it indicates a program bug.

Ian



More information about the Gcc-help mailing list