This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Miscompilation of remainder expressions
Gabriel Paubert <paubert@iram.es> writes:
| On Wed, Jan 17, 2007 at 04:15:08PM -0800, Ian Lance Taylor wrote:
| > Robert Dewar <dewar@adacore.com> writes:
| >
| > > Ian Lance Taylor wrote:
| > >
| > > > We do want to generate a trap for x / 0, of course.
| > >
| > > Really? Is this really defined to generate a trap in C?
| > > I would be surprised if so ...
| >
| > As far as I know, but I think it would be a surprising change for x /
| > 0 to silently continue executing.
| >
|
| That's exactly what happens on PPC.
Indeed, and Andrew Pinski corrected numeric_limits<int> to reflect
the reality on PPC for that specific case.
C++ forces compilers to reveal their semantics for built-in types
through numeric_limits<>. Every time you change the behaviour,
you also implicilty break an ABI.
-- Gaby