This is the mail archive of the
mailing list for the GCC project.
Re: Miscompilation of remainder expressions
- From: Roberto Bagnara <bagnara at cs dot unipr dot it>
- To: Robert Dewar <dewar at adacore dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Tue, 16 Jan 2007 19:11:33 +0100
- Subject: Re: Miscompilation of remainder expressions
- References: <45AB8770.firstname.lastname@example.org> <45AD0BD4.email@example.com>
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.
How do you test if a number is a multiple of another one?
What about rounding toward zero to a multiple of k?
x - x%k
looks like unreal code to you.
Prof. Roberto Bagnara
Computer Science Group
Department of Mathematics, University of Parma, Italy