bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#12350: Composites identified as primes in factor.c (when HAVE_GMP)


From: Jim Meyering
Subject: bug#12350: Composites identified as primes in factor.c (when HAVE_GMP)
Date: Mon, 17 Sep 2012 21:59:33 +0200

Torbjorn Granlund wrote:
...
> Please consider these additional changes:
>
> *** .~/cu-factor.c.~1~        Mon Sep 17 11:26:31 2012
> --- cu-factor.c       Mon Sep 17 15:45:05 2012
> ***************
> *** 134,139 ****
> --- 134,140 ----
>   #endif
>   #define LONGLONG_STANDALONE     /* Don't require GMP's longlong.h mdep 
> files */
>   #define ASSERT(x)               /* FIXME make longlong.h really standalone 
> */
> + #define __GMP_DECLSPEC          /* FIXME make longlong.h really standalone 
> */

Oh, that must be used in an #else branch that I'm not exercising.
It triggers a "symbol defined but never used" warning.
Thanks.

>   #define __clz_tab factor_clz_tab /* Rename to avoid glibc collision */

BTW, why does __clz_tab use the "__" prefix in the first place?

>   #ifndef __GMP_GNUC_PREREQ
>   #define __GMP_GNUC_PREREQ(a,b) 1
> ***************
> *** 143,149 ****
>   # endif
>   # include "longlong.h"
>   # ifdef COUNT_LEADING_ZEROS_NEED_CLZ_TAB
> ! const unsigned char factor_clz_tab[129] =
>   {
>     1,2,3,3,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
>     7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
> --- 144,150 ----
>   #endif
>   #include "longlong.h"
>   #ifdef COUNT_LEADING_ZEROS_NEED_CLZ_TAB
> ! static const unsigned char factor_clz_tab[129] =

Thanks.  Done.

>   {
>     1,2,3,3,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
>     7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
> ***************
> *** 1555,1561 ****
>   {
>     mpz_t x, z, y, P;
>     mpz_t t, t2;
> -   unsigned long long int k, l;
>
>     if (flag_verbose > 0)
>       {
> --- 1556,1561 ----
> ***************
> *** 1567,1574 ****
>     mpz_init_set_si (x, 2);
>     mpz_init_set_si (z, 2);
>     mpz_init_set_ui (P, 1);
> !   k = 1;
> !   l = 1;
>
>     while (mpz_cmp_ui (n, 1) != 0)
>       {
> --- 1567,1575 ----
>     mpz_init_set_si (x, 2);
>     mpz_init_set_si (z, 2);
>     mpz_init_set_ui (P, 1);
> !
> !   unsigned long long int k = 1;
> !   unsigned long long int l = 1;

Likewise.

>     while (mpz_cmp_ui (n, 1) != 0)
>       {
> ***************
> *** 2287,2293 ****
>
>   /* Read white-space delimited items. Return 1 on success, 0 on EOF.
>      Exit on I/O errors. */
> ! int
>   read_item (struct inbuf *bufstruct)
>   {
>     int c;
> --- 2288,2294 ----
>
>   /* Read white-space delimited items. Return 1 on success, 0 on EOF.
>      Exit on I/O errors. */
> ! static int

I didn't bother with this one, because in coreutils
I've just switched back to using readtokens to read input.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]