Re: possible miscompilation on macOS Catalina 10.15.6

2020-10-29 Thread Trevor Spiteri
On 28/10/2020 12:14, Torbjörn Granlund wrote:
> Trevor Spiteri  writes:
>
>   I maintain Rust language bindings to GMP and got a bug report from a
>   user on macOS Catalina 10.15.6.  I do not know if this issue is caused
>   by the particular system setup of the user or if it is more general, so
>   I'm listing what information I have in case it is actually reproducible
>   in a more general setting.
>
>   The bindings compilation process compiles GMP using:
>
>   ln -s path/to/extracted/gmp-6.2.0 gmp-src
>   mkdir gmp-build
>   cd gmp-build
>   ../gmp-src/configure --enable-fat --disable-shared --with-pic
>   make -j 8
>   make -j 8 check
>
>   The make check is failing and outputting this on standard error:
>
>   ../../../gmp-src/test-driver: line 107: 4825 Segmentation fault: 11 "$@"
>   > $log_file 2>&1
>   make[5]: *** [test-suite.log] Error 1
>   make[4]: *** [check-TESTS] Error 2
>   make[3]: *** [check-am] Error 2
>   make[2]: *** [check-recursive] Error 1
>   make[1]: *** [check-recursive] Error 1
>   make: *** [check] Error 2
>
>   I don't have standard output, so I don't know which test actually failed.
>
>   This is all the information I got; sorry if it is incomplete. (The
>   user's issue was solved by using their already installed homebrew?
>   libraries instead of compiling GMP anew.)
>
> OK, so *some* compiler compiled GMP with and *some* GMP test program
> reported a segfault.  I will right away start the natural deduction over
> all possible instances of compilers and GMP test cases. Oh wait, I need
> to consider all possible CPUs and relevant environment variables as
> well.

Sorry for not being clearer: I was only concerned that there was a
chance the combination

    configure --enable-fat --disable-shared --with-pic

might cause issues with Catalina's default compiler, if there even is
such a thing, and since I don't have such a system I couldn't test it
myself. If that's not the case, then the rest is of course useless
information.


___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: possible miscompilation on macOS Catalina 10.15.6

2020-10-29 Thread Paul Koning


> On Oct 29, 2020, at 11:17 AM, Niels Möller  wrote:
> 
> t...@gmplib.org (Torbjörn Granlund) writes:
> 
>> Trevor Spiteri  writes:
>> 
>>  This is all the information I got; sorry if it is incomplete. (The
>>  user's issue was solved by using their already installed homebrew?
>>  libraries instead of compiling GMP anew.)
>> 
>> OK, so *some* compiler compiled GMP with and *some* GMP test program
>> reported a segfault.  I will right away start the natural deduction over
>> all possible instances of compilers and GMP test cases. Oh wait, I need
>> to consider all possible CPUs and relevant environment variables as
>> well.
> 
> And to be a bit less sarcastic: Fairly recent Apple compilers have had
> bugs making them miscompile GMP. Most likely explanation for the
> reported problem is that your user has a buggy version of the compiler
> installed. So try a different compiler. And if you suspect it's a
> genuine GMP bug, please follow bug reporting instructions in the fine
> manual.

There is another possibility: GMP might be doing something undefined, where 
previous compilers did "what we want" while some recent new ones do something 
different.  It isn't miscompilation if the source statement is undefined.

paul

___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: possible miscompilation on macOS Catalina 10.15.6

2020-10-29 Thread Niels Möller
Paul Koning  writes:

> There is another possibility: GMP might be doing something undefined,
> where previous compilers did "what we want" while some recent new ones
> do something different. It isn't miscompilation if the source
> statement is undefined.

As a general statement, that's hard to dispute. But previous experience
is that most problems like this boil down to compiler bugs, after
someone spends the time to investigate properly. 

And the compiler shipped with the initial release of MacOS "Catalina",
in particular, has known issues, if I don't misremember previous reports
on this list.

So you have to forgive GMP developers of not being thrilled at spending
our spare time investigating, in particular if it's a proprietary
compiler with known bugs in recent history.

GMP correctness depends on the compiler getting arithmetic right
including in edge cases not exercised by most applications, and it also
has a pretty thorough test suite that tends to detect compiler bugs.

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: possible miscompilation on macOS Catalina 10.15.6

2020-10-29 Thread Niels Möller
t...@gmplib.org (Torbjörn Granlund) writes:

> Trevor Spiteri  writes:
>
>   This is all the information I got; sorry if it is incomplete. (The
>   user's issue was solved by using their already installed homebrew?
>   libraries instead of compiling GMP anew.)
>
> OK, so *some* compiler compiled GMP with and *some* GMP test program
> reported a segfault.  I will right away start the natural deduction over
> all possible instances of compilers and GMP test cases. Oh wait, I need
> to consider all possible CPUs and relevant environment variables as
> well.

And to be a bit less sarcastic: Fairly recent Apple compilers have had
bugs making them miscompile GMP. Most likely explanation for the
reported problem is that your user has a buggy version of the compiler
installed. So try a different compiler. And if you suspect it's a
genuine GMP bug, please follow bug reporting instructions in the fine
manual.

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: Make check fails on samsung S8 (2)

2020-10-29 Thread Marc Glisse

On Thu, 29 Oct 2020, Marco Bodrato wrote:


Ciao Marc,

Il 2020-08-22 19:39 Marc Glisse ha scritto:

Ah, on your OS nl_langinfo is defined inline as a static function in
langinfo.h, so the hack used in the test of redefining the function
cannot work. I guess we are supposed to add some configure check that
nl_langinfo can be redefined... although for just one platform we
could add a simple #if like we already do for mingw, so the test is
skipped.


Are you suggesting something like the following?


I think so, yes. Maybe Luc can confirm if that works?

Thanks,

--
Marc Glisse
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: Make check fails on samsung S8 (2)

2020-10-29 Thread Marco Bodrato

Ciao Marc,

Il 2020-08-22 19:39 Marc Glisse ha scritto:

Ah, on your OS nl_langinfo is defined inline as a static function in
langinfo.h, so the hack used in the test of redefining the function
cannot work. I guess we are supposed to add some configure check that
nl_langinfo can be redefined... although for just one platform we
could add a simple #if like we already do for mingw, so the test is
skipped.


Are you suggesting something like the following?

diff -r 3328dc92960a tests/misc/t-locale.c
--- a/tests/misc/t-locale.c Sun Oct 25 22:14:38 2020 +0100
+++ b/tests/misc/t-locale.c Thu Oct 29 02:43:25 2020 +0100
@@ -57,7 +57,7 @@
 #endif

 /* Replace the libc nl_langinfo with one we can manipulate. */
-#if HAVE_NL_LANGINFO
+#if HAVE_NL_LANGINFO && ! defined __TERMUX__
 char *
 nl_langinfo (nl_item n)
 #if defined __cplusplus && defined __GLIBC__

Ĝis,
m
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs