This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Miscompilation of remainder expressions


Ian Lance Taylor <iant@google.com> writes:

| 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.

furthermore, <limits> has been defined so that
numeric_limits<int>::traps reports true when division by zero traps.

// GCC only intrinsicly supports modulo integral types.  The only remaining
// integral exceptional values is division by zero.  Only targets that do not
// signal division by zero in some "hard to ignore" way should use false.
#ifndef __glibcxx_integral_traps
# define __glibcxx_integral_traps true
#endif

-- Gaby


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]