Dear All, I pulled a unstable version of GiNaC today. I was able to compile GiNaC, however "make check" failed with the following errors: exam_cra.cpp: In function 'int main(int, char**)': exam_cra.cpp:72: error: 'numeric_limits' is not a member of 'std' exam_cra.cpp:72: error: expected primary-expression before '(' token exam_cra.cpp:72: error: 'numeric_limits' is not a member of 'std' exam_cra.cpp:72: error: expected primary-expression before 'int' exam_cra.cpp:76: error: 'numeric_limits' is not a member of 'std' exam_cra.cpp:76: error: expected primary-expression before '(' token exam_cra.cpp:76: error: 'numeric_limits' is not a member of 'std' exam_cra.cpp:76: error: expected primary-expression before 'long' What can be a reason? Best wishes, Vladimir -- Vladimir V. Kisil email: kisilv@maths.leeds.ac.uk -- www: http://maths.leeds.ac.uk/~kisilv/
Dear Vladimir, On Mon, Oct 20, 2008 at 11:08:31PM +0100, Vladimir V. Kisil wrote:
I pulled a unstable version of GiNaC today. I was able to compile GiNaC, however "make check" failed with the following errors:
exam_cra.cpp: In function 'int main(int, char**)': exam_cra.cpp:72: error: 'numeric_limits' is not a member of 'std' exam_cra.cpp:72: error: expected primary-expression before '(' token exam_cra.cpp:72: error: 'numeric_limits' is not a member of 'std' exam_cra.cpp:72: error: expected primary-expression before 'int' exam_cra.cpp:76: error: 'numeric_limits' is not a member of 'std' exam_cra.cpp:76: error: expected primary-expression before '(' token exam_cra.cpp:76: error: 'numeric_limits' is not a member of 'std' exam_cra.cpp:76: error: expected primary-expression before 'long'
Could you please try the patch below? From: Alexei Sheplyakov <varg@theor.jinr.ru> Subject: [PATCH] exam_cra: explicitly #include <limits>. This should make g++ 4.3 happy. --- check/exam_cra.cpp | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/check/exam_cra.cpp b/check/exam_cra.cpp index 11e1ab7..2c6163e 100644 --- a/check/exam_cra.cpp +++ b/check/exam_cra.cpp @@ -7,6 +7,7 @@ #include <map> #include <vector> #include <stdexcept> +#include <limits> using namespace cln; using namespace std; -- 1.5.6.5 Best regards, Alexei -- All science is either physics or stamp collecting.
On Tue, 21 Oct 2008 10:14:40 +0400, Alexei Sheplyakov <varg@theor.jinr.ru> said: AS> Could you please try the patch below?
Thanks, Alexei, it compiles now. However I got an error while running the checks: examining Garner's integer chinese remainder algorithm /bin/sh: line 4: 17202 Segmentation fault ${dir}$tst FAIL: exam_cra Best wishes, Vladimir -- Vladimir V. Kisil email: kisilv@maths.leeds.ac.uk -- www: http://maths.leeds.ac.uk/~kisilv/
Dear Vladimir, On Tue, Oct 21, 2008 at 09:08:43AM +0100, Vladimir V. Kisil wrote:
examining Garner's integer chinese remainder algorithm /bin/sh: line 4: 17202 Segmentation fault ${dir}$tst FAIL: exam_cra
This information is not very useful on its own. Could you please post a. a backtrace. b. compiler version (and compilation options). c. version of CLN. Best regards, Alexei -- All science is either physics or stamp collecting.
Dear Alexei, I am sorry for the incomplete initial report on the problem. The requested information is: a. a backtrace. (gdb) r Starting program: /usr/local/distrib/math/ginac/check/.libs/lt-exam_cra examining Garner's integer chinese remainder algorithm Program received signal SIGSEGV, Segmentation fault. 0xb7bed2d0 in cln::find_modint_ring () from /usr/lib/libcln.so.5 (gdb) where #0 0xb7bed2d0 in cln::find_modint_ring () from /usr/lib/libcln.so.5 #1 0xb7ecd21f in compute_mix_radix_coeffs (dst=@0xbff5c570, residues=@0xbff5c728, moduli=@0xbff5c734, recips=@0xbff5c57c) at polynomial/cra_garner.cpp:44 #2 0xb7ece857 in cln::integer_cra (residues=@0xbff5c728, moduli=@0xbff5c734) at polynomial/cra_garner.cpp:81 #3 0x0804a140 in run_test_once (lim=<value optimized out>) at exam_cra.cpp:40 #4 0x0804aa57 in main () at exam_cra.cpp:65 b. compiler version (and compilation options) the current version in Debian/testing. $ gcc -v Using built-in specs. Target: i486-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.3.2-1' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --enable-shared --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --enable-nls --with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3 --enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc --enable-mpfr --enable-targets=all --enable-cld --enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu --target=i486-linux-gnu Thread model: posix gcc version 4.3.2 (Debian 4.3.2-1) c. version of CLN---the current version in Debian/testing. ii libcln5 1.2.2-2 Best wishes, Vladimir -- Vladimir V. Kisil email: kisilv@maths.leeds.ac.uk -- www: http://maths.leeds.ac.uk/~kisilv/
Dear Vladimir, On Wed, Oct 22, 2008 at 03:06:02PM +0100, Vladimir V. Kisil wrote:
(gdb) r Starting program: /usr/local/distrib/math/ginac/check/.libs/lt-exam_cra examining Garner's integer chinese remainder algorithm Program received signal SIGSEGV, Segmentation fault. 0xb7bed2d0 in cln::find_modint_ring () from /usr/lib/libcln.so.5 (gdb) where #0 0xb7bed2d0 in cln::find_modint_ring () from /usr/lib/libcln.so.5 #1 0xb7ecd21f in compute_mix_radix_coeffs (dst=@0xbff5c570, residues=@0xbff5c728, moduli=@0xbff5c734, recips=@0xbff5c57c) at polynomial/cra_garner.cpp:44 #2 0xb7ece857 in cln::integer_cra (residues=@0xbff5c728, moduli=@0xbff5c734) at polynomial/cra_garner.cpp:81 #3 0x0804a140 in run_test_once (lim=<value optimized out>) at exam_cra.cpp:40 #4 0x0804aa57 in main () at exam_cra.cpp:65
Thanks, I've managed to reproduce the bug. The patch below should fix it. Could you please check if it works for you? From: Alexei Sheplyakov <varg@theor.jinr.ru> Subject: [PATCH] [bugfix] integer_cra: check if arguments contain at least 2 moduli While at it, also fix exam_cra so it does not produce pointless inputs. --- check/exam_cra.cpp | 4 +++- ginac/polynomial/cra_garner.cpp | 3 +++ 2 files changed, 6 insertions(+), 1 deletions(-) diff --git a/check/exam_cra.cpp b/check/exam_cra.cpp index 2c6163e..6e24770 100644 --- a/check/exam_cra.cpp +++ b/check/exam_cra.cpp @@ -102,12 +102,14 @@ make_random_moduli(const cln::cl_I& limit) std::vector<cln::cl_I> moduli; cln::cl_I prod(1); cln::cl_I next = random_I(std::min(limit >> 1, cln::cl_I(128))); + unsigned count = 0; do { cln::cl_I tmp = nextprobprime(next); next = tmp + random_I(cln::cl_I(10)) + 1; prod = prod*tmp; moduli.push_back(tmp); - } while (prod < limit); + ++count; + } while (prod < limit || (count < 2)); return moduli; } diff --git a/ginac/polynomial/cra_garner.cpp b/ginac/polynomial/cra_garner.cpp index b400adb..76d1e07 100644 --- a/ginac/polynomial/cra_garner.cpp +++ b/ginac/polynomial/cra_garner.cpp @@ -3,6 +3,7 @@ #include <vector> #include <cstddef> #include "cra_garner.hpp" +#include "compiler.h" namespace cln { @@ -73,6 +74,8 @@ mixed_radix_2_ordinary(const vector<cl_I>& mixed_radix_coeffs, cl_I integer_cra(const vector<cl_I>& residues, const vector<cl_I>& moduli) { + if (unlikely(moduli.size() < 2)) + throw std::invalid_argument("integer_cra: need at least 2 moduli"); vector<cl_MI> recips(moduli.size() - 1); compute_recips(recips, moduli); -- 1.5.6.5 Best regards, Alexei -- All science is either physics or stamp collecting.
participants (2)
-
Alexei Sheplyakov
-
Vladimir V. Kisil