List of optimizations enabled by -O1 seems incorrect
Nikos Chantziaras
realnc@arcor.de
Thu Aug 13 21:36:00 GMT 2009
On 08/13/2009 10:38 PM, Kevin P. Fleming wrote:
> Nikos Chantziaras wrote:
>
>> Thanks for the tip. Looking at the generated assembly files, I finally
>> solved the "mystery": GCC uses SSE/SSE2 instructions to fetch both
>> variables in one CPU instruction. It's faster but circumvents
>> short-circuit "if" rules and Valgrind prints an error.
>
> Then that seems very broken; you should not have to have initialized a
> variable to avoid this issue, since short-circuit evaluation is defined
> in the C standard.
Damn, I thought that was it. Turns out it has nothing to do with SSE
(and the like) since compiling for -m32 -march=i386 and additionally
specifying -mno-sse/-mno-sse2/-mno-sse3/etc also triggers the "bug".
It has to be a "hidden" optimization that has no command-line switch.
The biggest problem is that I'm not able to produce a test case for it.
More information about the Gcc-help
mailing list