c langauge optimizer problem, sparc-solaris and debian gnu/linux

Martin v. Loewis martin@loewis.home.cs.tu-berlin.de
Fri Dec 31 20:54:00 GMT 1999


> The optimized code in the attached file results in runtime behavior
> that is different and incorrect, when compared to the runtime
> behavior of the non-optimized code.

Thanks for your bug report. Your program performs the computation

   if ( totalsize > (2147483647L   * 2UL + 1)  || (msize != 0 && ((msize - 1) > (2147483647L   * 2UL + 1) )))

I believe this computation causes an integer overflow on your
platform, which in turn results in undefined behaviour, according to
the C standard. Therefore, the compiler is entitled to produce any
output it wants, and that is not a bug.

Regards,
Martin



More information about the Gcc-bugs mailing list