Re: Report: gmp-6.1.2 on MacOS 10.15 using GCC and two Clang
> On 8 Nov 2019, at 18:26, Marco Bodrato wrote: > > Il Ven, 8 Novembre 2019 4:59 pm, Niels Möller ha scritto: >> Hans Åberg writes: >> >>> How about memory allocations? — There is info here, suggesting >>> uninitialized memory access in the test suite: > > Our priority is to avoid bugs in the library. So that we usually pay more > attention to the library code than to the code "in the test suite". ;-D Yes, of course. But those that are encouraged to make check get a scare. :-) ___ gmp-bugs mailing list gmp-bugs@gmplib.org https://gmplib.org/mailman/listinfo/gmp-bugs
Re: Report: gmp-6.1.2 on MacOS 10.15 using GCC and two Clang
Ciao, Il Ven, 8 Novembre 2019 4:59 pm, Niels Möller ha scritto: > Hans Åberg writes: > >> How about memory allocations? — There is info here, suggesting >> uninitialized memory access in the test suite: Our priority is to avoid bugs in the library. So that we usually pay more attention to the library code than to the code "in the test suite". ;-D > That issue was fixed by Marco a month and a half ago, see > https://gmplib.org/repo/gmp/rev/0688aef1f7e3. There probably were some > mention of the problem on gmp lists at the time, Of course: https://gmplib.org/list-archives/gmp-bugs/2019-September/004625.html > Seems unrelated to the stack alignment issue, though. Completely unrelated. Ĝis, m -- http://bodrato.it/papers/ ___ gmp-bugs mailing list gmp-bugs@gmplib.org https://gmplib.org/mailman/listinfo/gmp-bugs
Re: Report: gmp-6.1.2 on MacOS 10.15 using GCC and two Clang
Hans Åberg writes: > How about memory allocations? — There is info here, suggesting uninitialized > memory access in the test suite: > https://lists.llvm.org/pipermail/cfe-users/2019-November/001640.html That issue was fixed by Marco a month and a half ago, see https://gmplib.org/repo/gmp/rev/0688aef1f7e3. There probably were some mention of the problem on gmp lists at the time, but I can't look for that at the moment. Seems unrelated to the stack alignment issue, though. Regards, /Niels -- Niels Möller. PGP-encrypted email is preferred. Keyid 368C6677. Internet email is subject to wholesale government surveillance. ___ gmp-bugs mailing list gmp-bugs@gmplib.org https://gmplib.org/mailman/listinfo/gmp-bugs
Re: Report: gmp-6.1.2 on MacOS 10.15 using GCC and two Clang
> On 8 Nov 2019, at 15:48, Torbjörn Granlund wrote: > > There is info here, suggesting > uninitialized memory access in the test suite: > https://lists.llvm.org/pipermail/cfe-users/2019-November/001640.html > > What are you trying to contribute to the discussion in the Subject line? > > Apple suggests that the stack pointer is not properly aligned. > > The quoted text does not seem to have anything to do with the issue at > hand. It is the same issue, but discussed on another list. I leave it up to you to interpret it: I was interested in another issue. ___ gmp-bugs mailing list gmp-bugs@gmplib.org https://gmplib.org/mailman/listinfo/gmp-bugs
Re: Report: gmp-6.1.2 on MacOS 10.15 using GCC and two Clang
Hans Åberg writes: > On 20 Oct 2019, at 22:14, Torbjörn Granlund wrote: > > Believe it or not, but the GMP devs are pretty good at computer > arithmetic. How about memory allocations? — There is info here, suggesting uninitialized memory access in the test suite: https://lists.llvm.org/pipermail/cfe-users/2019-November/001640.html What are you trying to contribute to the discussion in the Subject line? Apple suggests that the stack pointer is not properly aligned. The quoted text does not seem to have anything to do with the issue at hand. Let's help to keep the signal-to-noise ration high here on the GMP lists. -- Torbjörn Please encrypt, key id 0xC8601622 ___ gmp-bugs mailing list gmp-bugs@gmplib.org https://gmplib.org/mailman/listinfo/gmp-bugs
Re: Report: gmp-6.1.2 on MacOS 10.15 using GCC and two Clang
> On 20 Oct 2019, at 22:14, Torbjörn Granlund wrote: > > Believe it or not, but the GMP devs are pretty good at computer > arithmetic. How about memory allocations? — There is info here, suggesting uninitialized memory access in the test suite: https://lists.llvm.org/pipermail/cfe-users/2019-November/001640.html ___ gmp-bugs mailing list gmp-bugs@gmplib.org https://gmplib.org/mailman/listinfo/gmp-bugs
Re: Report: gmp-6.1.2 on MacOS 10.15 using GCC and two Clang
> On 20 Oct 2019, at 22:14, Torbjörn Granlund wrote: > > Hans Åberg writes: > >> I believe we assume signed integers are in two's complement. > > Strictly, it is for signed overflows one cannot assume modulo 2^n, n = > number of bits. For the unsigned integer types it is required, > though. > > Believe it or not, but the GMP devs are pretty good at computer > arithmetic. Sorry for offending you: My response was to the part you snipped, which you did not detail. And on the Bison list a very savvy C programmer suggested the rule was one’s complement legacy, apparently not realizing modern optimization use. ___ gmp-bugs mailing list gmp-bugs@gmplib.org https://gmplib.org/mailman/listinfo/gmp-bugs
Re: Report: gmp-6.1.2 on MacOS 10.15 using GCC and two Clang
> On 20 Oct 2019, at 21:44, Torbjörn Granlund wrote: > > Hans Åberg 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. Strictly, it is for signed overflows one cannot assume modulo 2^n, n = number of bits. For the unsigned integer types it is required, though. Here is a list for various languages: https://en.wikipedia.org/wiki/Integer_overflow ___ gmp-bugs mailing list gmp-bugs@gmplib.org https://gmplib.org/mailman/listinfo/gmp-bugs
Re: Report: gmp-6.1.2 on MacOS 10.15 using GCC and two Clang
Hans Åberg writes: Strictly, it is for signed overflows one cannot assume modulo 2^n, n = number of bits. For the unsigned integer types it is required, though. Believe it or not, but the GMP devs are pretty good at computer arithmetic. -- Torbjörn Please encrypt, key id 0xC8601622 ___ gmp-bugs mailing list gmp-bugs@gmplib.org https://gmplib.org/mailman/listinfo/gmp-bugs
Re: Report: gmp-6.1.2 on MacOS 10.15 using GCC and two Clang
Hans Åberg 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 ___ gmp-bugs mailing list gmp-bugs@gmplib.org https://gmplib.org/mailman/listinfo/gmp-bugs
Re: Report: gmp-6.1.2 on MacOS 10.15 using GCC and two Clang
> On 20 Oct 2019, at 13:24, Torbjörn Granlund wrote: > > Hans Åberg 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 gmp-bugs@gmplib.org https://gmplib.org/mailman/listinfo/gmp-bugs
Re: Report: gmp-6.1.2 on MacOS 10.15 using GCC and two Clang
Hans Åberg 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. -- Torbjörn Please encrypt, key id 0xC8601622 ___ gmp-bugs mailing list gmp-bugs@gmplib.org https://gmplib.org/mailman/listinfo/gmp-bugs