GNU bug report logs -
#12350
Composites identified as primes in factor.c (when HAVE_GMP)
Previous Next
Reported by: Torbjorn Granlund <tg <at> gmplib.org>
Date: Tue, 4 Sep 2012 13:29:02 UTC
Severity: normal
Done: Jim Meyering <meyering <at> hx.meyering.net>
Bug is archived. No further changes may be made.
Full log
Message #229 received at 12350 <at> debbugs.gnu.org (full text, mbox):
Pádraig Brady wrote:
...
>> Thanks, but wouldn't that be a slight "pessimization"?
>> What do you think about providing the missing function instead?
>> Maybe not worth the hassle, but still, it would avoid adding those 12
>> in-function lines. factor.c is already large and complex enough that
>> every little bit helps.
>
> Borderline, but to align code with newer libs,
> I've done as you suggest in the attached.
...
Thank you!
That looks great.
> Subject: [PATCH] build: support older GMP versions
>
> The new factor code introduced usage of mpz_inits() and
> mpz_clears(), which are only available since GMP >= 5,
> and will result in a compile error when missing.
>
> * m4/gmp.m4 (cu_GMP): Define HAVE_DECL_MPZ_INITS appropriately.
> * src/factor (mpz_inits): New function, defined where missing.
> (mpz_clears): Likewise.
> ---
> m4/gmp.m4 | 2 ++
> src/factor.c | 23 +++++++++++++++++++++++
> 2 files changed, 25 insertions(+), 0 deletions(-)
>
> diff --git a/m4/gmp.m4 b/m4/gmp.m4
> index e337e16..59a664f 100644
> --- a/m4/gmp.m4
> +++ b/m4/gmp.m4
> @@ -30,6 +30,8 @@ AC_DEFUN([cu_GMP],
> LIB_GMP=$ac_cv_search___gmpz_init
> AC_DEFINE([HAVE_GMP], [1],
> [Define if you have GNU libgmp (or replacement)])
> + # This only available in GMP >= 5
# This is available only in GMP >= 5
> + AC_CHECK_DECLS([mpz_inits], [], [], [[#include <gmp.h>]])
> }],
> [AC_MSG_WARN([libgmp development library was not found or not usable.])
> AC_MSG_WARN([AC_PACKAGE_NAME will be built without GMP support.])])
This bug report was last modified 12 years and 277 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.