This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: List of optimizations enabled by -O1 seems incorrect


Andrew Haley wrote:
> 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.
> 
> Yes, but it's covered by the "as if" rule: if no conforming program could
> ever notice the difference, an optimization is allowed.

Well, I guess that was my point, stated in another way. I'm certainly no
C standard expert, but I didn't think his program was 'non-conforming'
in any way.

-- 
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
skype: kpfleming | jabber: kpfleming@digium.com
Check us out at www.digium.com & www.asterisk.org


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]