summarylogtreecommitdiffstats
path: root/15.patch
blob: 053d8658f27e403b04a4168261ebfc8ea7eda0b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
From e37104a2836cf5a9c341850be68333ecb6cc7a52 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Daniel=20=C8=98uteu?= <trizen@protonmail.com>
Date: Sun, 19 Jan 2020 01:18:51 +0200
Subject: [PATCH] Fix squfof_factor() under GMP 6.2.0

Under GMP 6.2.0, the tests failed with a "segmentation fault" on `squfof_factor("1754012594703269855671")`.
---
 squfof126.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/squfof126.c b/squfof126.c
index abb05c0..f99346e 100644
--- a/squfof126.c
+++ b/squfof126.c
@@ -50,8 +50,9 @@ static INLINE void mpz_set64(mpz_t n, SQUFOF_TYPE v) {
     mpz_mul_2exp(n, n, 32);
     mpz_add_ui(n, n, (uint32_t)v);
   } else {
-    n->_mp_d[0] = v;
-    n->_mp_size = 1;
+    //n->_mp_d[0] = v;
+    //n->_mp_size = 1;
+    mpz_set_ui(n, (uint64_t)v);
   }
 }