Report: gmp-6.1.2 on MacOS 10.15 using GCC and two Clang

Torbjörn Granlund tg at gmplib.org
Sun Oct 20 19:44:39 UTC 2019


Hans Åberg <haberg-1 at telia.com> writes:

  A common programming error is assuming that signed integer types are
  two’s complement, because even though all current CPUs are that,
  overflows are undefined in C/C++, and an optimizer can take advantage
  of that. One example from [1]: checking overflows with x > x + 1 may
  work as intended with optimization turned off, but when on, the
  optimizer can assume that it is always false since x + 1 is undefined
  when overflowed.

I believe we assume signed integers are in two's complement.

We don't do a lot of arithmetic on signed integers, though.

-- 
Torbjörn
Please encrypt, key id 0xC8601622


More information about the gmp-bugs mailing list