Re: Possibly an annoying test in configure

2023-08-21 Thread Dennis Clarke

On 8/21/23 11:31, Arsen Arsenović wrote:


Torbjörn Granlund  writes:


Dennis Clarke  writes:

   Pretty sure that should be "int main (void) { return 0; } ".

Surely that is not how the implicit main() declaration looks?  A new
compiler warning is warranted.  So add (int argc, const char **argv)!
Oops, unused parameters, darn.  We need to make a fake dependency on
these unused parameters...

Alternatively, we could develop GMP.

   How hard can it be to patch that in the configure.ac autotools stuff?

It is pointless to work around compiler idiosyncrasies without a plan,
and without clear indications that it solves a real problem.


These should be fixed upstream in Autoconf already:
https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=8b5e2016c7ed2d

This is a somewhat well known change in Clang (and upcoming, though not
current, GCC), and is also a change that was done in ISO C over twenty
years ago.

We, as well as Fedora, and likely others have been fixing these in
various programs for a while:
https://wiki.gentoo.org/wiki/Modern_C_porting

Dennis, would you mind testing with Autoconf 2.72c to see if the issue
persists?  You can fetch it from
https://alpha.gnu.org/gnu/autoconf/autoconf-2.72c.tar.xz


This is not entirely off-topic for GMP/MPFR but certainly out on the
bitter edge. Maybe best to move this off to a maillist for autotools.

Thus, I will get onto that for a few systems. Likely :

1) FreeBSD 14.0 ALPHA2 on the RISC-V rv64imafdc
2) FreeBSD 14.0 ALPHA2 on aarch64
3) Gentoo Linux on sparcv9
4) other stuff running around me ... :)



--
Dennis Clarke
RISC-V/SPARC/PPC/ARM/CISC
UNIX and Linux spoken
GreyBeard and suspenders optional

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


Re: Possibly an annoying test in configure

2023-08-21 Thread Arsen Arsenović

Torbjörn Granlund  writes:

> Dennis Clarke  writes:
>
>   Pretty sure that should be "int main (void) { return 0; } ".
>
> Surely that is not how the implicit main() declaration looks?  A new
> compiler warning is warranted.  So add (int argc, const char **argv)!
> Oops, unused parameters, darn.  We need to make a fake dependency on
> these unused parameters...
>
> Alternatively, we could develop GMP.
>
>   How hard can it be to patch that in the configure.ac autotools stuff?
>
> It is pointless to work around compiler idiosyncrasies without a plan,
> and without clear indications that it solves a real problem.

These should be fixed upstream in Autoconf already:
https://git.savannah.gnu.org/cgit/autoconf.git/commit/?id=8b5e2016c7ed2d

This is a somewhat well known change in Clang (and upcoming, though not
current, GCC), and is also a change that was done in ISO C over twenty
years ago.

We, as well as Fedora, and likely others have been fixing these in
various programs for a while:
https://wiki.gentoo.org/wiki/Modern_C_porting

Dennis, would you mind testing with Autoconf 2.72c to see if the issue
persists?  You can fetch it from
https://alpha.gnu.org/gnu/autoconf/autoconf-2.72c.tar.xz
-- 
Arsen Arsenović


signature.asc
Description: PGP signature
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: Outdated libtool creates trouble on macOS

2023-08-21 Thread FX Coudert
> Ah, that normally happens as part of LT_INIT, and what is broken is that we 
> use some other libtool autoconf macro before LT_INIT. We should move things 
> so GMP_PROG_NM (or at least LT_PATH_NM) is after LT_INIT.

I was just arriving at the same conclusion, from my own testing.

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


Re: Outdated libtool creates trouble on macOS

2023-08-21 Thread Marc Glisse

On Mon, 21 Aug 2023, Marc Glisse wrote:

because SED is used before it is set. I guess AC_PROG_SED might help, but 
since all the uses of SED are introduced by autotools, it feels like a bug 
that they don't add it automatically.


Ah, that normally happens as part of LT_INIT, and what is broken is that 
we use some other libtool autoconf macro before LT_INIT. We should move 
things so GMP_PROG_NM (or at least LT_PATH_NM) is after LT_INIT.


(LT_PATH_NM used to be AC_PROG_NM and not part of libtool I think, so it 
didn't need this ordering in the past)


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


Re: Outdated libtool creates trouble on macOS

2023-08-21 Thread Marc Glisse

On Mon, 31 Jul 2023, FX Coudert wrote:


Hopefully this makes gmp future-proof for at least 10 years in terms of 
autoconf/automake :)


I pushed most of your changes (the windows one will have to wait a bit), 
thanks. There should not be any regressions with the old autotools. But 
note that if I generate with new autotools then run configure, I am still 
seeing the broken behavior


checking for BSD- or MS-compatible name lister (nm)... 
/home/glisse/repos/gmp/configure: line 12165: 1q: command not found

/home/glisse/repos/gmp/configure: line 12171: 1q: command not found
/home/glisse/repos/gmp/configure: line 12165: 1q: command not found
/home/glisse/repos/gmp/configure: line 12171: 1q: command not found
/home/glisse/repos/gmp/configure: line 12165: 1q: command not found
/home/glisse/repos/gmp/configure: line 12171: 1q: command not found

because SED is used before it is set. I guess AC_PROG_SED might help, but 
since all the uses of SED are introduced by autotools, it feels like a bug 
that they don't add it automatically.


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


Re: Outdated libtool creates trouble on macOS

2023-08-21 Thread Marc Glisse

On Mon, 31 Jul 2023, FX Coudert wrote:


warning: The macro `AC_PROG_CC_C99' is obsolete.


This one is only obsolete in autoconf 2.70+, so I am keeping it for now.

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


Re: Outdated libtool creates trouble on macOS

2023-08-21 Thread Marc Glisse

On Sun, 30 Jul 2023, FX Coudert wrote:


PS: second patchlet, to deal with these two macros:


warning: The macro `AC_HEADER_STDC' is obsolete.
warning: The macro `AC_HEADER_TIME' is obsolete.


I am a bit confused why this change makes ylwrap appear in am__DIST_COMMON 
in Makefile.in, but that seems benign enough.


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


Re: bug in __gmp_replacement_vsnprintf

2023-08-21 Thread Vincent Lefevre
On 2023-08-21 10:59:13 +0200, Paul Zimmermann wrote:
> here is a small program that exhibits the bug (for example on gcc231):
[...]

An OpenBSD 7 machine, and this is due to the fact that %n is
no longer supported by the system *printf functions, so that
GMP uses __gmp_replacement_vsnprintf.

See also in the archives:

https://gmplib.org/list-archives/gmp-bugs/2022-October/005200.html
https://gmplib.org/list-archives/gmp-bugs/2023-January/005230.html

-- 
Vincent Lefèvre  - Web: 
100% accessible validated (X)HTML - Blog: 
Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon)
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


bug in __gmp_replacement_vsnprintf

2023-08-21 Thread Paul Zimmermann
   Hi,

here is a small program that exhibits the bug (for example on gcc231):

gcc231$ cat bug.c
#include 
#include 
#include 

static void
foo (char **buf, const char *fmt, ...)
{
  va_list ap;
  va_start (ap, fmt);
  gmp_vasprintf (buf, fmt, ap);
  va_end (ap);
}

int
main (int argc, char **argv)
{
  char *buf[1];
  foo (buf, "%a", -1.25);
  printf ("buf='%s'\n", buf[0]);
}

gcc231$ cc -I. bug.c .libs/libgmp.a   
.libs/libgmp.a(doprntf.o): In function `__gmp_doprnt_mpf2':
doprntf.c:(.text+0x2c4): warning: sprintf() is often misused, please use 
snprintf()
.libs/libgmp.a(repl-vsnprintf.o): In function `__gmp_replacement_vsnprintf':
repl-vsnprintf.c:(.text+0x3a8): warning: vsprintf() is often misused, please 
use vsnprintf()

gcc231$ ./a.out   
repl-vsnprintf.c:389: GNU MP assertion failed: len < total_width
Abort trap (core dumped) 

You can also reproduce on any other computer after uncommenting
#define HAVE_VSNPRINTF 1 in config.h.

Paul

PS: it would be nice to add some tests with %a or %A in tests/misc/t-printf.c
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs


Re: GMP Error Reporting

2023-08-21 Thread Paul Zimmermann
   Hi,

it appears the value of c3 before the call mpf_sqrt() is negative,
and mpf_sqrt() does not allow negative inputs.

Best regards,
Paul Zimmermann

> From: "posihydr" 
> Date: Sat, 19 Aug 2023 21:50:37 +0800
> 
> 
> [1:text/plain Hide]
> 
> A description of the problem:
> The problem occurs when the formula in GMP and < Picture 1> is used to 
> calculate PI, calculate the constant C to the 3/2 power, output "Floating 
> point exception" after running the program, and use GDB debugging to find 
> that the program receives signal SIGFPE when calling mpf_sqrt function.
> The following is written according to the 
> https://gmplib.org/manual/Reporting-Bugs report:
> 1. GMP Version number: 6.3.0 (not prepackaged and not patched)
> 2. The test program is  3. The program crashes directly
> 4. < Picture 2>
> 5. None
> 6../configure --prefix=/opt/gmp-6.3.0
> 7. I can't provide the information as it was built
> 8. < Picture 3>
> 9. < Picture 3>
> 10. aarch64-unknown-linux-gnu
> 11. None
> 12. None
> 
> 
> It was translated from Chinese by Youdao.
> 
> [2:application/octet-stream Show Save:bug.c (975B)]
> 
> 
> [3:application/octet-stream Show Save:Picture 1.jpg (140kB)]
> 
> 
> [4:application/octet-stream Show Save:Picture 2.jpg (426kB)]
> 
> 
> [5:application/octet-stream Show Save:Picture 3.jpg (466kB)]
> 
> 
> [6:text/plain Hide]
> 
> ___
> gmp-bugs mailing list
> gmp-bugs@gmplib.org
> https://gmplib.org/mailman/listinfo/gmp-bugs
___
gmp-bugs mailing list
gmp-bugs@gmplib.org
https://gmplib.org/mailman/listinfo/gmp-bugs