This is the mail archive of the
mailing list for the GCC project.
Re: Miscompilation of remainder expressions
Vincent Lefevre wrote:
On 2007-01-16 12:31:00 -0500, Robert Dewar wrote:
Roberto Bagnara wrote:
Reading the thread "Autoconf manual's coverage of signed integer
overflow & portability" I was horrified to discover about GCC's
miscompilation of the remainder expression that causes INT_MIN % -1
to cause a SIGFPE on CPUs of the i386 family. Are there plans to
fix this bug (which, to me, looks quite serious)?
Seems ultra-non-serious to me, hard to believe this case appears
in real code, despite surprising claim by Roberto.
What makes you think so?
One never knows. We (the MPFR developers) found several compiler bugs
concerning particular cases like that, which occurred in MPFR. One of
them (in some gcc version) was 0 + LONG_MIN, which was different from
LONG_MIN. Is 0 + LONG_MIN so different from INT_MIN % -1, for instance?
The difference is that your program didn't get killed by SIGFPE, it just
gave incorrect results.