This is the mail archive of the gcc-bugs@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]

Re: x86 regression: optimizer bug in 1.1 and dev


Horst von Brand <vonbrand@sleipnir.valparaiso.cl> writes:
> Mumit Khan <khan@xraylith.wisc.edu> said:
> > Versions affected: 1.1 and development snapshots. REGRESSION from 1.0.3.
> > 
> > The following optimizer bug shows up on i686-pc-linux-gnu, i386-*win32 
> > (and possibly other x86) ports when using -Ox, x >= 2.
> > 
> > Thanks to Peter Kabal <Kabal@ece.mcgill.ca> for the report and attached 
> > testcase.
> > 
> > To reproduce on i686-pc-linux-gnu:
> >   
> >   $ gcc -O2 -D__NO_MATH_INLINES -o floor-bug floor-bug.c

Ooops. Please add the missing -lm. Thanks for pointing this out.

      $ gcc -O2 -D__NO_MATH_INLINES -o floor-bug floor-bug.c -lm

> I see the exact same result here, but I had to add -lm to link in the math
> library.  You sure it's not a glibc bug (no -D__NO_MATH_INLINES gives:
> 
> AV = 20, AV - floor(AV) = 1

That's when inlined math comes in, and you get the correct results. I'm a 
complete novice at x86 assembly and don't really know what the problem 
here is. Can anybody with a libc5 system check this out please?

Note that I can reproduce the bug on i386-cygwin32 (uses newlib) *and*
i386-mingw32 (uses Microsoft runtime) newlib as well, so I doubt if
it's a glibc2 problem.

Regards,
Mumit



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