On 19/05/15 17:03, Ramana Radhakrishnan wrote: > On Tue, May 19, 2015 at 4:54 PM, <pins...@gmail.com> wrote: >>> On May 19, 2015, at 5:54 AM, Ramana Radhakrishnan >>> <ramana.radhakrish...@foss.arm.com> wrote: >>> Like the ARM port, the AArch64 ports needs to set glibc_integral_traps to >>> false as integer divide instructions do not trap. >>> >>> Bootstrapped and regression tested on aarch64-none-linux-gnu >>> >>> Ok to apply ? >> >> Not really questioning your patch but questioning libstdc++'s defaults. >> I wonder if this should be the default as most targets don't trap, only a >> few that does. And it should be safer default to say they don't trap too? > > How about we #error out if targets do *not* define some of these > defaults in libstdc++ ?
__glibcxx_integral_traps seems to be used for the 'traps' numeric_limits<T> member. i think it can only be meaningful if LIA-1 is properly supported (eg. div-by-zero is never optimized away) otherwise the standard dictates UB and anything can happen. (Note that LIA-1 also requires well-defined semantics for signed int overflow). i don't see a way for conforming c++ code to use traps, or for the library to guarantee either traps==true or traps==false on any machine.