Re: Optimize flag breaks code on many versions of gcc (not all)

2006-06-19 Thread tbp
On 6/19/06, Richard Guenther <[EMAIL PROTECTED]> wrote: Using -mfpmath=sse -msse2 is a workaround if you have a processor that supports SSE2 instructions. As opposed to -ffloat-store, it works reliably and with no performance impact. Such slab test can be turned into a branchless sequence of SS

Re: Optimize flag breaks code on many versions of gcc (not all)

2006-06-19 Thread Richard Guenther
On 6/19/06, Seongbae Park <[EMAIL PROTECTED]> wrote: On 6/19/06, Dave Korn <[EMAIL PROTECTED]> wrote: > On 19 June 2006 00:04, Paolo Carlini wrote: > > > Zdenek Dvorak wrote: > > > >> ... I suspect there is something wrong with your > >> code (possibly invoking some undefined

Re: Optimize flag breaks code on many versions of gcc (not all)

2006-06-19 Thread Seongbae Park
On 6/19/06, Dave Korn <[EMAIL PROTECTED]> wrote: On 19 June 2006 00:04, Paolo Carlini wrote: > Zdenek Dvorak wrote: > >> ... I suspect there is something wrong with your >> code (possibly invoking some undefined behavior, using uninitialized >> variable, sensitivity to roundi

RE: Optimize flag breaks code on many versions of gcc (not all)

2006-06-19 Thread Dave Korn
On 19 June 2006 00:04, Paolo Carlini wrote: > Zdenek Dvorak wrote: > >> ... I suspect there is something wrong with your >> code (possibly invoking some undefined behavior, using uninitialized >> variable, sensitivity to rounding errors, or something like that). >> >> > A da

Re: Optimize flag breaks code on many versions of gcc (not all)

2006-06-18 Thread Seongbae Park
On 6/18/06, Paolo Carlini <[EMAIL PROTECTED]> wrote: Zdenek Dvorak wrote: >... I suspect there is something wrong with your >code (possibly invoking some undefined behavior, using uninitialized >variable, sensitivity to rounding errors, or something like that). > > A data poi

Re: Optimize flag breaks code on many versions of gcc (not all)

2006-06-18 Thread Paolo Carlini
Zdenek Dvorak wrote: ... I suspect there is something wrong with your code (possibly invoking some undefined behavior, using uninitialized variable, sensitivity to rounding errors, or something like that). A data point apparently in favor of this suspect is that the "probl

Re: Optimize flag breaks code on many versions of gcc (not all)

2006-06-18 Thread Jack Howarth
Interestingly this problem doesn't appear with gcc trunk on ppc Darwin (MacOS X 10.4) using any optimization level (-O, -O0, -O1, -02 or -O3). It also doesn't appear with Apple's own g++ based on 4.0.1. I can reproduce the problem with the gcc 4.1.1 from Fedora Core 5 on a dual Xeon though.

Re: Optimize flag breaks code on many versions of gcc (not all)

2006-06-18 Thread Zdenek Dvorak
Hello, > This 'little' program behaves bad when compiled with -O. It works fine > when no -O or -O0 is used. > > The function is from Graphics Gem I and has been ported from C to C++ > http://www.acm.org/pubs/tog/GraphicsGems/gems.html#gems > Woo, Andrew, Fast Ray-Box Intersection, p. 395-396,

Re: Optimize flag breaks code on many versions of gcc (not all)

2006-06-18 Thread Robert Dewar
minus wrote: This 'little' program behaves bad when compiled with -O. It works fine when no -O or -O0 is used. You need to debug and find out exactly what went wrong. You don't even know this is a compiler problem yet (lots of user errors in code show up only if the optimizer is active, e.g. th

Optimize flag breaks code on many versions of gcc (not all)

2006-06-18 Thread minus
This 'little' program behaves bad when compiled with -O. It works fine when no -O or -O0 is used. The function is from Graphics Gem I and has been ported from C to C++ http://www.acm.org/pubs/tog/GraphicsGems/gems.html#gems Woo, Andrew, Fast Ray-Box Intersection, p. 395-396, code: p. 736-737 Th