This is the mail archive of the
mailing list for the GCC project.
Re: Miscompilation of remainder expressions
- From: Paolo Carlini <pcarlini at suse dot de>
- To: Roberto Bagnara <bagnara at cs dot unipr dot it>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 15 Jan 2007 15:05:56 +0100
- Subject: Re: Miscompilation of remainder expressions
- References: <45AB8770.email@example.com>
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)?
If I understand correctly your problem, I was also battling with it a
few days ago, and found 5.6/4 rather obscure, i.e., I'm not sure to
understand what we can reasonably expect from the remainder operator
when one or both operands are negative... Then, while fixing
libstdc++/30416 I decided to be super-safe, that is only compute
remainders of nonnegative operands... I would like to understand the
issue better, however...