From b02836a63d3b41464c320dae10b2e402416ba282 Mon Sep 17 00:00:00 2001
From: Paul Zimmermann <Paul.Zimmermann@inria.fr>
Date: Tue, 25 Jun 2024 11:01:37 +0200
Subject: [PATCH] added valgrind suppressions file

---
 ecm.supp             | 21 +++++++++++++++++++++
 m4/valgrind-tests.m4 |  2 +-
 2 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 ecm.supp

diff --git a/ecm.supp b/ecm.supp
new file mode 100644
index 00000000..fd737615
--- /dev/null
+++ b/ecm.supp
@@ -0,0 +1,21 @@
+# This is a suppression file for valgrind
+
+# In order to generate it, re-run valgrind as follows:
+# valgrind --leak-check=full --gen-suppressions=all --log-file=ecm.supp ./my_program arg1 # arg2 ...
+
+# The "..." joker matches several possible lines in the call trace.
+
+
+{
+   copyi_false_positive
+   Memcheck:Addr8
+   fun:__gmpn_copyi
+   obj:/usr/lib/x86_64-linux-gnu/libgmp.so.10.5.0
+   fun:__gmpn_mul_fft
+   fun:__ecm_mpres_mul_z_to_z
+   fun:pm1_sequence_g
+   fun:__ecm_pm1fs2_ntt
+   fun:pm1
+   fun:ecm_factor
+   fun:main
+}
diff --git a/m4/valgrind-tests.m4 b/m4/valgrind-tests.m4
index 025b7fbc..977dd047 100644
--- a/m4/valgrind-tests.m4
+++ b/m4/valgrind-tests.m4
@@ -11,7 +11,7 @@ AC_DEFUN([gl_VALGRIND_TESTS],
   if test "$opt_valgrind_tests" = "yes" && test "$cross_compiling" = no; then
     AC_CHECK_PROGS(VALGRIND, valgrind)
   fi
-  OPTS="-q --error-exitcode=1 --leak-check=full"
+  OPTS="-q --error-exitcode=1 --leak-check=full --suppressions=ecm.supp"
   if test -n "$VALGRIND" \
      && $VALGRIND $OPTS $SHELL -c 'exit 0' > /dev/null 2>&1; then
     opt_valgrind_tests=yes
-- 
GitLab