summaryrefslogtreecommitdiff
path: root/src/factor.c
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2011-05-25 12:29:18 +0200
committerJim Meyering <meyering@redhat.com>2011-05-26 22:13:37 +0200
commit419b6c9d42ba643265f802cd150d0b232e43186a (patch)
tree993d42ce541942f5863de308c98ff773cf29ab32 /src/factor.c
parentd7e23652039b5e145ab0d809a7de75ebb3facc24 (diff)
downloadcoreutils-419b6c9d42ba643265f802cd150d0b232e43186a.tar.xz
maint: accommodate gcc's -Wstrict-overflow option
* src/factor.c (factor_using_pollard_rho): Change type of "i" to unsigned to avoid warning from gcc's -Wstrict-overflow. * src/expr.c: Use an unsigned intermediate. * src/dircolors.c (main): Reorder operations to avoid the risk of pointer overflow. * src/tr.c (squeeze_filter): Change NOT_A_CHAR from an anonymous "enum" to an "int", to avoid this warning: tr.c:1624:10: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow] * src/pr.c (main): Make index "i" unsigned.
Diffstat (limited to 'src/factor.c')
-rw-r--r--src/factor.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/factor.c b/src/factor.c
index 3354a4d5b..27843201c 100644
--- a/src/factor.c
+++ b/src/factor.c
@@ -160,7 +160,7 @@ factor_using_pollard_rho (mpz_t n, int a_int)
mpz_t a;
mpz_t g;
mpz_t t1, t2;
- int k, l, c, i;
+ int k, l, c;
debug ("[pollard-rho (%d)] ", a_int);
@@ -204,6 +204,7 @@ S2:
mpz_set (x1, x);
k = l;
l = 2 * l;
+ unsigned int i;
for (i = 0; i < k; i++)
{
mpz_mul (x, x, x); mpz_add (x, x, a); mpz_mod (x, x, n);