The package rpms/flint.git has added or updated architecture specific content in its
spec file (ExclusiveArch/ExcludeArch or %ifarch/%ifnarch) in commit(s):
https://src.fedoraproject.org/cgit/rpms/flint.git/commit/?id=be7ed008faae....
Change:
+%ifarch %{ix86} %{arm} s390 %{mips32}
Thanks.
Full change:
============
commit be7ed008faae9c97e2bd783f284b757be8208c65
Author: Jerry James <loganjerry(a)gmail.com>
Date: Sun Mar 31 08:01:32 2019 -0600
Drop the workaround for bz 1555151, now fixed.
diff --git a/flint.spec b/flint.spec
index a742513..a63bf2c 100644
--- a/flint.spec
+++ b/flint.spec
@@ -7,7 +7,7 @@
Name: flint
Version: 2.5.2
-Release: 25%{?dist}
+Release: 26%{?dist}
Summary: Fast Library for Number Theory
License: GPLv2+
URL:
http://www.flintlib.org/
@@ -147,14 +147,9 @@ export CFLAGS="%{optflags} -fwrapv -D_FILE_OFFSET_BITS=64"
# We set HAVE_FAST_COMPILER to 0 on i686, ARM, s390, and 32-bit MIPS because
# otherwise the tests exhaust virtual memory. If other architectures run out
#of virtual memory while building flintxx/test/t-fmpzxx.cpp, then do likewise.
-%ifarch %{arm}
-# Work around bz 1555151
-CFLAGS="$CFLAGS -DHAVE_FAST_COMPILER=0 -fno-tree-tail-merge"
-%else
-%ifarch %{ix86} s390 %{mips32}
+%ifarch %{ix86} %{arm} s390 %{mips32}
CFLAGS="$CFLAGS -DHAVE_FAST_COMPILER=0"
%endif
-%endif
export CXXFLAGS="$CFLAGS"
# Build the non-gc version
@@ -249,6 +244,9 @@ popd
%changelog
+* Sat Mar 30 2019 Jerry James <loganjerry(a)gmail.com> - 2.5.2-26
+- Drop the workaround for bz 1555151, now fixed
+
* Thu Jan 31 2019 Fedora Release Engineering <releng(a)fedoraproject.org> - 2.5.2-25
- Rebuilt for
https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
commit 0a86c7c3b96e395a5e153e23c1ddd66a3b42ff73
Author: Jerry James <loganjerry(a)gmail.com>
Date: Tue Feb 26 20:25:56 2019 -0700
Fix the FTBFS on ppc64le, plug memory leaks, avoid buffer overruns.
diff --git a/flint-fmpz-poly-q-clear.patch b/flint-fmpz-poly-q-clear.patch
new file mode 100644
index 0000000..2fe9b8f
--- /dev/null
+++ b/flint-fmpz-poly-q-clear.patch
@@ -0,0 +1,11 @@
+--- fmpz_poly_q/clear.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ fmpz_poly_q/clear.c 2019-02-21 11:08:35.139584243 -0700
+@@ -33,7 +33,7 @@ void fmpz_poly_q_clear(fmpz_poly_q_t rop
+ flint_free(rop->num);
+ rop->num = NULL;
+ }
+- if (rop->den != NULL);
++ if (rop->den != NULL)
+ {
+ fmpz_poly_clear(rop->den);
+ flint_free(rop->den);
diff --git a/flint-latex.patch b/flint-latex.patch
index f585985..044c894 100644
--- a/flint-latex.patch
+++ b/flint-latex.patch
@@ -1,3 +1,14 @@
+--- doc/latex/create_doc.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ doc/latex/create_doc.c 2019-02-21 11:16:59.061459215 -0700
+@@ -161,7 +161,7 @@ printfuncheader(const char* text, int le
+ else
+ {
+ int hasspace = text[i - 1] == ' ';
+- while(i < len-1 && text[++i] == ' ' || text[i] ==
'\t');
++ while(i < len-1 && (text[++i] == ' ' || text[i] ==
'\t'));
+ if(!hasspace)
+ fprintf(out, " ");
+ }
--- doc/latex/flint-manual.tex.orig 2015-08-13 10:16:22.000000000 -0600
+++ doc/latex/flint-manual.tex 2018-08-01 08:24:39.366717507 -0600
@@ -54,7 +54,8 @@
@@ -10,3 +21,25 @@
\usepackage{ae,aecompl}
\usepackage{booktabs}
\usepackage{multirow}
+--- fmpz_mat/doc/fmpz_mat.txt.orig 2015-08-13 10:16:22.000000000 -0600
++++ fmpz_mat/doc/fmpz_mat.txt 2019-02-21 10:53:55.942126273 -0700
+@@ -1114,7 +1114,7 @@ void fmpz_mat_gram(fmpz_mat_t B, const f
+
+ Sets \code{B} to the Gram matrix of the $m$-dimensional lattice \code{L} in
+ $n$-dimensional Euclidean space $R^n$ spanned by the rows of
+- the $m$ $n$ matrix \code{A}. Dimensions must be compatible.
++ the $m x n$ matrix \code{A}. Dimensions must be compatible.
+ \code{A} and \code{B} are allowed to be the same object if \code{A} is a
+ square matrix.
+
+--- fmpz_poly/doc/fmpz_poly.txt.orig 2015-08-13 10:16:22.000000000 -0600
++++ fmpz_poly/doc/fmpz_poly.txt 2019-02-21 10:52:26.023215528 -0700
+@@ -2985,7 +2985,7 @@ void fmpz_poly_bound_roots(fmpz_t bound,
+ $$
+ 2 \max \left(
+ \left|\frac{a_{n-1}}{a_n}\right|,
+- \left|\frac{a_{n-2}}{a_n}\right|^{\frac{1}{2}}, \dots
++ \left|\frac{a_{n-2}}{a_n}\right|^{\frac{1}{2}}, \dotsc
+ \left|\frac{a_1}{a_n}\right|^{\frac{1}{n-1}},
+ \left|\frac{a_0}{2a_n}\right|^{\frac{1}{n}}
+ \right)
diff --git a/flint-longlong.patch b/flint-longlong.patch
new file mode 100644
index 0000000..07a3d1b
--- /dev/null
+++ b/flint-longlong.patch
@@ -0,0 +1,44 @@
+--- longlong.h.orig 2015-08-13 10:16:22.000000000 -0600
++++ longlong.h 2019-02-21 10:57:17.395685912 -0700
+@@ -32,6 +32,11 @@
+ extern "C" {
+ #endif
+
++/* Undefine to make the ifndef logic below for the fallback
++ work even if the symbols are already defined (e.g. by givaro). */
++#undef count_leading_zeros
++#undef count_trailing_zeros
++
+ /* x86 : 64 bit */
+ #if (GMP_LIMB_BITS == 64 && defined (__amd64__))
+
+@@ -60,12 +65,12 @@
+ : "%0" ((mp_limb_t)(u)), "rm" ((mp_limb_t)(v)))
+
+ #define udiv_qrnnd(q, r, n1, n0, dx) \
+- __asm__ ("divq %4"
\
++ __asm__ __volatile__ ("divq %4"
\
+ : "=a" (q), "=d" (r)
\
+ : "0" ((mp_limb_t)(n0)), "1" ((mp_limb_t)(n1)),
"rm" ((mp_limb_t)(dx)))
+
+ #define sdiv_qrnnd(q, r, n1, n0, dx) \
+- __asm__ ("idivq %4"
\
++ __asm__ __volatile__ ("idivq %4"
\
+ : "=a" (q), "=d" (r)
\
+ : "0" ((mp_limb_t)(n0)), "1" ((mp_limb_t)(n1)),
"rm" ((mp_limb_t)(dx)))
+
+@@ -117,12 +122,12 @@
+ : "%0" ((mp_limb_t)(u)), "rm" ((mp_limb_t)(v)))
+
+ #define udiv_qrnnd(q, r, n1, n0, dx) \
+- __asm__ ("divl %4"
\
++ __asm__ __volatile__ ("divl %4"
\
+ : "=a" (q), "=d" (r)
\
+ : "0" ((mp_limb_t)(n0)), "1" ((mp_limb_t)(n1)),
"rm" ((mp_limb_t)(dx)))
+
+ #define sdiv_qrnnd(q, r, n1, n0, dx) \
+- __asm__ ("idivl %4"
\
++ __asm__ __volatile__ ("idivl %4"
\
+ : "=a" (q), "=d" (r)
\
+ : "0" ((mp_limb_t)(n0)), "1" ((mp_limb_t)(n1)),
"rm" ((mp_limb_t)(dx)))
+
diff --git a/flint-overrun.patch b/flint-overrun.patch
new file mode 100644
index 0000000..da3df05
--- /dev/null
+++ b/flint-overrun.patch
@@ -0,0 +1,334 @@
+--- fmpz_poly/gcd_heuristic.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ fmpz_poly/gcd_heuristic.c 2019-02-20 20:46:00.714971279 -0700
+@@ -220,7 +220,7 @@ _fmpz_poly_gcd_heuristic(fmpz * res, con
+ qlimbs = limbs1 - limbsg + 1;
+ qlen = FLINT_MIN(len1, (qlimbs*FLINT_BITS)/pack_bits + 1);
+ qlimbs = (qlen*pack_bits - 1)/FLINT_BITS + 1;
+- q = flint_calloc(qlimbs, sizeof(mp_limb_t));
++ q = flint_calloc(qlimbs + 1, sizeof(mp_limb_t));
+ temp = flint_malloc(limbsg*sizeof(mp_limb_t));
+
+ divides = 0;
+--- fmpz_poly_mat/clear.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ fmpz_poly_mat/clear.c 2019-02-22 09:38:32.089703913 -0700
+@@ -24,6 +24,7 @@
+ ******************************************************************************/
+
+ #include <stdlib.h>
++#include <string.h>
+ #include "flint.h"
+ #include "fmpz_poly.h"
+ #include "fmpz_poly_mat.h"
+@@ -41,4 +42,5 @@ fmpz_poly_mat_clear(fmpz_poly_mat_t A)
+ flint_free(A->entries);
+ flint_free(A->rows);
+ }
++ memset(A, 0, sizeof(*A));
+ }
+--- fmpz_poly_mat/init.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ fmpz_poly_mat/init.c 2019-02-22 15:45:34.429403916 -0700
+@@ -24,6 +24,7 @@
+ ******************************************************************************/
+
+ #include <stdlib.h>
++#include <string.h>
+ #include "flint.h"
+ #include "fmpz_poly.h"
+ #include "fmpz_poly_mat.h"
+@@ -43,10 +44,10 @@ fmpz_poly_mat_init(fmpz_poly_mat_t A, sl
+
+ for (i = 0; i < rows; i++)
+ A->rows[i] = A->entries + i * cols;
++
++ A->r = rows;
++ A->c = cols;
+ }
+ else
+- A->entries = NULL;
+-
+- A->r = rows;
+- A->c = cols;
++ memset(A, 0, sizeof(*A));
+ }
+--- fmpz_poly_mat/window_clear.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ fmpz_poly_mat/window_clear.c 2019-02-22 15:42:08.446972613 -0700
+@@ -24,11 +24,15 @@
+
+ ******************************************************************************/
+
++#include <string.h>
+ #include "fmpz_poly_mat.h"
+
+ void
+ fmpz_poly_mat_window_clear(fmpz_poly_mat_t window)
+ {
+- if (window->entries)
++ if (window->rows)
++ {
+ flint_free(window->rows);
++ memset(window, 0, sizeof(*window));
++ }
+ }
+--- fmpz_poly_mat/window_init.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ fmpz_poly_mat/window_init.c 2019-02-22 15:44:05.187516816 -0700
+@@ -24,6 +24,7 @@
+
+ ******************************************************************************/
+
++#include <string.h>
+ #include "fmpz_poly_mat.h"
+
+ void
+@@ -33,12 +34,16 @@ fmpz_poly_mat_window_init(fmpz_poly_mat_
+ slong i;
+ window->entries = NULL;
+
+- if (r2 - r1)
++ if (c2 > c1 && r2 > r1)
++ {
+ window->rows = flint_malloc((r2 - r1) * sizeof(fmpz_poly_t));
+
+- for (i = 0; i < r2 - r1; i++)
+- window->rows[i] = mat->rows[r1 + i] + c1;
++ for (i = 0; i < r2 - r1; i++)
++ window->rows[i] = mat->rows[r1 + i] + c1;
+
+- window->r = r2 - r1;
+- window->c = c2 - c1;
++ window->r = r2 - r1;
++ window->c = c2 - c1;
++ }
++ else
++ memset(window, 0, sizeof(*window));
+ }
+--- fq_poly_factor_templates/factor_berlekamp.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ fq_poly_factor_templates/factor_berlekamp.c 2019-02-25 15:41:46.136872369 -0700
+@@ -278,6 +278,7 @@ __TEMPLATE(T, poly_factor_berlekamp) (TE
+ TEMPLATE(T, clear) (mul, ctx);
+ fmpz_clear(pow);
+ fmpz_clear(p);
++ fmpz_clear(q);
+ fmpz_clear(s);
+ }
+
+--- fq_poly_factor_templates/is_irreducible_ben_or.c.orig 2015-08-13 10:16:22.000000000
-0600
++++ fq_poly_factor_templates/is_irreducible_ben_or.c 2019-02-26 19:45:35.681301008 -0700
+@@ -97,6 +97,8 @@ TEMPLATE(T, poly_is_irreducible_ben_or)
+ }
+ }
+
++ TEMPLATE(T, poly_clear) (g, ctx);
++ TEMPLATE(T, poly_clear) (x, ctx);
+ TEMPLATE(T, poly_clear) (xq, ctx);
+ TEMPLATE(T, poly_clear) (xqimx, ctx);
+ TEMPLATE(T, poly_clear) (v, ctx);
+--- fq_poly_templates/div_newton_n_preinv.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ fq_poly_templates/div_newton_n_preinv.c 2019-02-24 16:43:41.479823977 -0700
+@@ -94,7 +94,7 @@ TEMPLATE(T, poly_div_newton_n_preinv) (T
+
+ if (Q == A || Q == B || Q == Binv)
+ {
+- flint_free(Q->coeffs);
++ TEMPLATE(T, poly_clear) (Q, ctx);
+ Q->coeffs = q;
+ Q->alloc = lenQ;
+ }
+--- fq_poly_templates/divrem_newton_n_preinv.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ fq_poly_templates/divrem_newton_n_preinv.c 2019-02-24 15:23:03.443165017 -0700
+@@ -111,13 +111,13 @@ TEMPLATE(T, poly_divrem_newton_n_preinv)
+
+ if (Q == A || Q == B || Q == Binv)
+ {
+- _TEMPLATE(T, vec_clear) (Q->coeffs, lenA - lenB + 1, ctx);
++ _TEMPLATE(T, vec_clear) (Q->coeffs, Q->alloc, ctx);
+ Q->coeffs = q;
+ Q->alloc = lenA - lenB + 1;
+ }
+ if (R == A || R == B || R == Binv)
+ {
+- _TEMPLATE(T, vec_clear) (R->coeffs, lenB - 1, ctx);
++ _TEMPLATE(T, vec_clear) (R->coeffs, R->alloc, ctx);
+ R->coeffs = r;
+ R->alloc = lenB - 1;
+ }
+--- fq_poly_templates/evaluate_fq_vec_fast.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ fq_poly_templates/evaluate_fq_vec_fast.c 2019-02-26 08:48:44.651661567 -0700
+@@ -60,6 +60,7 @@ _TEMPLATE4(T, poly_evaluate, T, vec_fast
+ TEMPLATE(T, set)(vs + i, poly, ctx);
+
+ TEMPLATE(T, clear)(temp, ctx);
++ TEMPLATE(T, clear)(inv, ctx);
+ return;
+ }
+
+--- fq_poly_templates/gcd_hgcd.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ fq_poly_templates/gcd_hgcd.c 2019-02-23 17:01:46.896155151 -0700
+@@ -161,6 +161,7 @@ void TEMPLATE(T, poly_gcd_hgcd) (TEMPLAT
+
+ lenG = _TEMPLATE(T, poly_gcd_hgcd) (g, A->coeffs, lenA,
+ B->coeffs, lenB, invB, ctx);
++ TEMPLATE(T, clear) (invB, ctx);
+
+ if (G == A || G == B)
+ {
+--- fq_zech/get_str.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ fq_zech/get_str.c 2019-02-26 08:53:54.640290281 -0700
+@@ -28,7 +28,7 @@
+ char *
+ fq_zech_get_str(const fq_zech_t op, const fq_zech_ctx_t ctx)
+ {
+- char *s = flint_malloc(n_clog(op->value, 10) * sizeof(char));
++ char *s = flint_malloc(n_clog(op->value, 10) * sizeof(char) + 6U);
+ flint_sprintf(s, "%wd", op->value);
+ return s;
+ }
+--- fq_zech/get_str_pretty.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ fq_zech/get_str_pretty.c 2019-02-26 08:56:59.623084857 -0700
+@@ -30,7 +30,7 @@ char *
+ fq_zech_get_str_pretty(const fq_zech_t op, const fq_zech_ctx_t ctx)
+ {
+ char *s = flint_malloc((n_clog(op->value, 10) +
strlen(ctx->fq_nmod_ctx->var) + 1) *
+- sizeof(char));
++ sizeof(char) + 8U);
+ flint_sprintf(s, "%s^%wd", ctx->fq_nmod_ctx->var, op->value);
+ return s;
+ }
+--- nmod_matxx.h.orig 2015-08-13 10:16:22.000000000 -0600
++++ nmod_matxx.h 2019-02-26 09:05:17.432516298 -0700
+@@ -429,8 +429,15 @@ private:
+ nmod_mat_init_set(data[i], o.data[i]);
+ }
+
++ void clear(void)
++ {
++ for(std::size_t i = 0; i < size_;++i)
++ nmod_mat_clear(data[i]);
++ delete[] data;
++ }
++
+ public:
+- ~nmod_mat_vector() {delete[] data;}
++ ~nmod_mat_vector() {clear();}
+ nmod_mat_vector(slong rows, slong cols, const std::vector<mp_limb_t>&
primes)
+ {
+ size_ = primes.size();
+@@ -446,7 +453,7 @@ public:
+
+ nmod_mat_vector& operator=(const nmod_mat_vector& o)
+ {
+- delete[] data;
++ clear();
+ init(o);
+ return *this;
+ }
+--- nmod_poly/get_str_pretty.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ nmod_poly/get_str_pretty.c 2019-02-26 08:44:16.807300744 -0700
+@@ -46,7 +46,7 @@ char * nmod_poly_get_str_pretty(const nm
+ }
+ else if (poly->length == 1)
+ {
+- size = (ulong) ceil(0.30103*FLINT_BIT_COUNT(poly->coeffs[0]));
++ size = (ulong) ceil(0.30103*FLINT_BIT_COUNT(poly->coeffs[0])) + 3U;
+ buf = (char *) flint_malloc(size);
+ flint_sprintf(buf, "%wu", poly->coeffs[0]);
+ return buf;
+--- nmod_poly_mat/clear.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ nmod_poly_mat/clear.c 2019-02-22 15:39:58.479593393 -0700
+@@ -23,6 +23,7 @@
+
+ ******************************************************************************/
+
++#include <string.h>
+ #include "flint.h"
+ #include "nmod_poly.h"
+ #include "nmod_poly_mat.h"
+@@ -40,4 +41,5 @@ nmod_poly_mat_clear(nmod_poly_mat_t A)
+ flint_free(A->entries);
+ flint_free(A->rows);
+ }
++ memset(A, 0, sizeof(*A));
+ }
+--- nmod_poly_mat/init.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ nmod_poly_mat/init.c 2019-02-23 21:04:49.876161996 -0700
+@@ -43,11 +43,15 @@ nmod_poly_mat_init(nmod_poly_mat_t A, sl
+
+ for (i = 0; i < rows; i++)
+ A->rows[i] = A->entries + i * cols;
++
++ A->r = rows;
++ A->c = cols;
+ }
+ else
++ {
+ A->entries = NULL;
+-
++ A->r = 0;
++ A->c = 0;
++ }
+ A->modulus = n;
+- A->r = rows;
+- A->c = cols;
+ }
+--- nmod_poly_mat/window_clear.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ nmod_poly_mat/window_clear.c 2019-02-22 15:41:56.615120167 -0700
+@@ -23,14 +23,16 @@
+
+ ******************************************************************************/
+
++#include <string.h>
+ #include "nmod_poly_mat.h"
+
+ void
+ nmod_poly_mat_window_clear(nmod_poly_mat_t window)
+ {
+- if (window->entries)
++ if (window->rows)
+ {
+ flint_free(window->rows);
++ memset(window, 0, sizeof(*window));
+ }
+
+ }
+--- nmod_poly_mat/window_init.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ nmod_poly_mat/window_init.c 2019-02-22 15:43:46.413750923 -0700
+@@ -23,6 +23,7 @@
+
+ ******************************************************************************/
+
++#include <string.h>
+ #include "nmod_poly_mat.h"
+
+ void
+@@ -32,12 +33,16 @@ nmod_poly_mat_window_init(nmod_poly_mat_
+ slong i;
+ window->entries = NULL;
+
+- if (r2 - r1)
++ if (c2 > c1 && r2 > r1)
++ {
+ window->rows = flint_malloc((r2 - r1) * sizeof(nmod_poly_t));
+
+- for (i = 0; i < r2 - r1; i++)
+- window->rows[i] = mat->rows[r1 + i] + c1;
++ for (i = 0; i < r2 - r1; i++)
++ window->rows[i] = mat->rows[r1 + i] + c1;
+
+- window->r = r2 - r1;
+- window->c = c2 - c1;
++ window->r = r2 - r1;
++ window->c = c2 - c1;
++ }
++ else
++ memset(window, 0, sizeof(*window));
+ }
+--- sscanf.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ sscanf.c 2019-02-10 13:51:35.212462799 -0700
+@@ -47,7 +47,7 @@ int flint_sscanf(const char * s, const c
+ return 0;
+
+ str2 = flint_malloc(len + 1);
+- s2 = flint_malloc(strlen(s) + 1);
++ s2 = flint_malloc(strlen(s) + 32);
+
+ /* deal with first substring */
+ n = strcspn(str, "%");
diff --git a/flint-test.patch b/flint-test.patch
new file mode 100644
index 0000000..82dc730
--- /dev/null
+++ b/flint-test.patch
@@ -0,0 +1,165 @@
+--- fmpq_poly/test/t-print_read.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ fmpq_poly/test/t-print_read.c 2019-02-22 14:50:59.393485167 -0700
+@@ -110,6 +110,9 @@ int main(void)
+ }
+
+ fclose(out);
++ for (i = 0; i < n; ++i)
++ fmpq_poly_clear(a[i]);
++ flint_free(a);
+ exit(0);
+ }
+ else /* Parent process */
+--- fmpq/test/t-height.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ fmpq/test/t-height.c 2019-02-21 11:23:21.680439751 -0700
+@@ -53,7 +53,7 @@ main(void)
+ fmpq_height(h, x);
+ b = fmpq_height_bits(x);
+
+- if (!fmpz_bits(h) == b)
++ if (fmpz_bits(h) != b)
+ {
+ flint_printf("FAIL!\n");
+ flint_printf("x: ");
+--- fmpz_mat/test/t-print_read.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ fmpz_mat/test/t-print_read.c 2019-02-22 14:51:43.289921592 -0700
+@@ -111,6 +111,9 @@ int main(void)
+ }
+
+ fclose(out);
++ for (i = 0; i < k; ++i)
++ fmpz_mat_clear(M[i]);
++ flint_free(M);
+ exit(0);
+ }
+ else /* Parent process */
+--- fmpz_poly_mat/test/t-nullspace.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ fmpz_poly_mat/test/t-nullspace.c 2019-02-22 13:34:02.791332036 -0700
+@@ -48,7 +48,7 @@ main(void)
+ slong n, m, bits, deg, rank, nullity;
+ float density;
+
+- m = n_randint(state, 13);
++ m = n_randint(state, 12) + 1;
+ n = n_randint(state, 13);
+ deg = 1 + n_randint(state, 5);
+ bits = 1 + n_randint(state, 100);
+--- fmpz_poly/test/t-print_read.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ fmpz_poly/test/t-print_read.c 2019-02-22 14:49:26.866673065 -0700
+@@ -109,6 +109,9 @@ int main(void)
+ }
+
+ fclose(out);
++ for (i = 0; i < n; ++i)
++ fmpz_poly_clear(a[i]);
++ flint_free(a);
+ exit(0);
+ }
+ else /* Parent process */
+--- fmpz_poly/test/t-print_read_pretty.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ fmpz_poly/test/t-print_read_pretty.c 2019-02-22 14:50:07.211155094 -0700
+@@ -110,6 +110,9 @@ int main(void)
+ }
+
+ fclose(out);
++ for (i = 0; i < n; ++i)
++ fmpz_poly_clear(a[i]);
++ flint_free(a);
+ exit(0);
+ }
+ else /* Parent process */
+--- fmpz/test/t-out_inp_raw.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ fmpz/test/t-out_inp_raw.c 2019-02-22 14:47:40.956032788 -0700
+@@ -108,6 +108,9 @@ int main(void)
+ }
+
+ fclose(out);
++ for (i = 0; i < n; ++i)
++ fmpz_clear(a + i);
++ flint_free(a);
+ exit(0);
+ }
+ else /* Parent process */
+--- fmpz/test/t-print_read.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ fmpz/test/t-print_read.c 2019-02-22 14:46:06.110250470 -0700
+@@ -105,6 +105,9 @@ int main(void)
+ }
+
+ fclose(out);
++ for (i = 0; i < n; ++i)
++ fmpz_clear(a + i);
++ flint_free(a);
+ exit(0);
+ }
+ else /* Parent process */
+--- fq_mat_templates/test/t-window_init_clear.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ fq_mat_templates/test/t-window_init_clear.c 2019-02-23 11:47:18.956187020 -0700
+@@ -75,6 +75,7 @@ main(void)
+
+ TEMPLATE(T, mat_window_clear) (w, ctx);
+ TEMPLATE(T, mat_clear) (a, ctx);
++ TEMPLATE(T, ctx_clear) (ctx);
+ }
+
+
+--- fq_poly_templates/test/t-evaluate_fq_vec_fast.c.orig 2015-08-13 10:16:22.000000000
-0600
++++ fq_poly_templates/test/t-evaluate_fq_vec_fast.c 2019-02-23 16:45:54.529890188 -0700
+@@ -86,6 +86,7 @@ main(void)
+ _TEMPLATE(T, vec_clear)(x, npoints, ctx);
+ _TEMPLATE(T, vec_clear)(y, npoints, ctx);
+ _TEMPLATE(T, vec_clear)(z, npoints, ctx);
++ TEMPLATE(T, ctx_clear)(ctx);
+ }
+
+ FLINT_TEST_CLEANUP(state);
+--- fq_poly_templates/test/t-gcd.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ fq_poly_templates/test/t-gcd.c 2019-02-23 19:04:11.991529870 -0700
+@@ -77,6 +77,7 @@ main(void)
+ TEMPLATE(T, poly_clear) (a, ctx);
+ TEMPLATE(T, poly_clear) (b, ctx);
+ TEMPLATE(T, poly_clear) (g, ctx);
++ TEMPLATE(T, ctx_clear) (ctx);
+ }
+
+
+--- fq_poly_templates/test/t-gcd_euclidean.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ fq_poly_templates/test/t-gcd_euclidean.c 2019-02-23 18:12:35.598651689 -0700
+@@ -77,6 +77,7 @@ main(void)
+ TEMPLATE(T, poly_clear) (a, ctx);
+ TEMPLATE(T, poly_clear) (b, ctx);
+ TEMPLATE(T, poly_clear) (g, ctx);
++ TEMPLATE(T, ctx_clear) (ctx);
+ }
+
+
+--- fq_poly_templates/test/t-make_monic.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ fq_poly_templates/test/t-make_monic.c 2019-02-23 13:30:09.414620801 -0700
+@@ -69,6 +69,7 @@ main(void)
+ }
+
+ TEMPLATE(T, poly_clear) (a, ctx);
++ TEMPLATE(T, poly_clear) (b, ctx);
+ TEMPLATE(T, ctx_clear) (ctx);
+ }
+
+--- fq_templates/test/t-is_invertible_f.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ fq_templates/test/t-is_invertible_f.c 2019-02-26 08:34:07.342856149 -0700
+@@ -49,7 +49,6 @@ main(void)
+ TEMPLATE(T, t) a, ainv, f, g;
+
+ TEMPLATE(T, ctx_randtest_reducible)(ctx, state);
+- TEMPLATE(T, init)(f, ctx);
+
+ TEMPLATE(T, init)(a, ctx);
+ TEMPLATE(T, init)(f, ctx);
+--- nmod_poly_mat/test/t-nullspace.c.orig 2015-08-13 10:16:22.000000000 -0600
++++ nmod_poly_mat/test/t-nullspace.c 2019-02-22 15:47:54.842652863 -0700
+@@ -48,7 +48,7 @@ main(void)
+ mp_limb_t mod;
+
+ mod = n_randtest_prime(state, 0);
+- m = n_randint(state, 13);
++ m = n_randint(state, 12) + 1;
+ n = n_randint(state, 13);
+ deg = 1 + n_randint(state, 5);
+ density = n_randint(state, 100) * 0.01;
diff --git a/flint.spec b/flint.spec
index 9cf0205..a742513 100644
--- a/flint.spec
+++ b/flint.spec
@@ -23,8 +23,18 @@ Patch2: %{name}-float.patch
Patch3: %{name}-gcc5.patch
# Use the popcnt instruction when available
Patch4: %{name}-popcnt.patch
-# Adapt to recent LaTeX encoding changes
+# Adapt to recent LaTeX encoding changes and fix other LaTeX problems
Patch5: %{name}-latex.patch
+# Fix issues with longlong.h
+#
https://sources.debian.org/patches/flint/2.5.2-19/undef_count_leading_zer...
+#
https://sources.debian.org/patches/flint/2.5.2-19/asm_volatile_div.patch/
+Patch6: %{name}-longlong.patch
+# Fix buffer overruns
+Patch7: %{name}-overrun.patch
+# Fix a typo that could cause a crash
+Patch8: %{name}-fmpz-poly-q-clear.patch
+# Fix bugs in tests
+Patch9: %{name}-test.patch
BuildRequires: gc-devel
BuildRequires: gcc-c++
@@ -89,6 +99,10 @@ pushd %{name}-%{version}
%patch3
%patch4
%patch5
+%patch6
+%patch7
+%patch8
+%patch9
# Do not use rpaths
sed -i 's/ -Wl,-rpath,[^"]*\("\)/\1/' configure
@@ -129,17 +143,16 @@ done
%build
+export CFLAGS="%{optflags} -fwrapv -D_FILE_OFFSET_BITS=64"
# We set HAVE_FAST_COMPILER to 0 on i686, ARM, s390, and 32-bit MIPS because
# otherwise the tests exhaust virtual memory. If other architectures run out
#of virtual memory while building flintxx/test/t-fmpzxx.cpp, then do likewise.
%ifarch %{arm}
# Work around bz 1555151
-export CFLAGS="%{optflags} -D_FILE_OFFSET_BITS=64 -DHAVE_FAST_COMPILER=0
-fno-tree-tail-merge"
+CFLAGS="$CFLAGS -DHAVE_FAST_COMPILER=0 -fno-tree-tail-merge"
%else
%ifarch %{ix86} s390 %{mips32}
-export CFLAGS="%{optflags} -D_FILE_OFFSET_BITS=64 -DHAVE_FAST_COMPILER=0"
-%else
-export CFLAGS="%{optflags} -D_FILE_OFFSET_BITS=64"
+CFLAGS="$CFLAGS -DHAVE_FAST_COMPILER=0"
%endif
%endif
export CXXFLAGS="$CFLAGS"
@@ -160,7 +173,7 @@ sh -x ./configure \
CXXFLAGS="$CXXFLAGS"
# FIXME: %%{?_smp_mflags} sometimes fails
-make verbose LDFLAGS="-Wl,--as-needed $RPM_LD_FLAGS" LIBDIR=%{_lib}
+make verbose LDFLAGS="$RPM_LD_FLAGS" LIBDIR=%{_lib}
# Build the documentation
ln -sf . doc/latex/flint
@@ -183,7 +196,7 @@ sh -x ./configure \
CXXFLAGS="$CXXFLAGS"
# FIXME: %%{?_smp_mflags} sometimes fails
-make verbose LDFLAGS="-Wl,--as-needed $RPM_LD_FLAGS" LIBDIR=%{_lib}
+make verbose LDFLAGS="$RPM_LD_FLAGS" LIBDIR=%{_lib}
popd
@@ -209,13 +222,10 @@ popd
%check
pushd %{name}-%{version}
make check QUIET_CC= QUIET_CXX= QUIET_AR= \
- LDFLAGS="-Wl,--as-needed $RPM_LD_FLAGS" LIBDIR=%{_lib}
+ LDFLAGS="$RPM_LD_FLAGS" LIBDIR=%{_lib}
popd
-%ldconfig_scriptlets
-
-
%files
%doc %{name}-%{version}/AUTHORS
%doc %{name}-%{version}/NEWS