> On 20 Oct 2019, at 13:24, Torbjörn Granlund <[email protected]> wrote:
> 
> Hans Åberg <[email protected]> writes:
> 
>  I have compiled gmp-6.1.2 on MacOS 10.15 using the inhouse Apple clang
>  and the MacPorts gcc9 and clang9, with ‘make check’. All tests passed
>  on gcc9, but the two clang had one error each.
> 
> Several people seem to have trouble with using clang.  When clang first
> appeared, I isolated several of the GMP failures only to determine that
> they were clang codegen bugs.  I don't have time to debug clang for
> Apple or the other clang devs, and this new GMP failure is with very
> high probability yet another clang codegen bug.

Then I will have to do it for you: :-)

It is an optimization issue. When turning it off, both clang pass.

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 do not know if anything like that is done in GMP.


1. http://blog.llvm.org/2011/05/what-every-c-programmer-should-know.html


_______________________________________________
gmp-bugs mailing list
[email protected]
https://gmplib.org/mailman/listinfo/gmp-bugs

Reply via email to