[Gmp-commit] /var/hg/gmp-6.1: Backport: Avoid left shift of negative value in...

mercurial at gmplib.org mercurial at gmplib.org
Wed Nov 30 09:17:22 UTC 2016


details:   /var/hg/gmp-6.1/rev/53f948a9ded6
changeset: 16956:53f948a9ded6
user:      Marc Glisse <marc.glisse at inria.fr>
date:      Wed Nov 30 10:17:19 2016 +0100
description:
Backport: Avoid left shift of negative value in tests.

diffstat:

 ChangeLog           |  4 ++++
 tests/cxx/t-ops2.cc |  2 +-
 2 files changed, 5 insertions(+), 1 deletions(-)

diffs (26 lines):

diff -r c76ef1d3effe -r 53f948a9ded6 ChangeLog
--- a/ChangeLog	Wed Nov 30 00:50:44 2016 +0100
+++ b/ChangeLog	Wed Nov 30 10:17:19 2016 +0100
@@ -12,6 +12,10 @@
 
 	* configure.ac: Make udiv_w_sdiv use conditional on enable_assembly.
 
+2016-11-25  Marc Glisse  <marc.glisse at inria.fr>
+
+	* tests/cxx/t-ops2.cc (checkz): Avoid left shift of negative number.
+
 2016-11-22  Torbjörn Granlund  <tg at gmplib.org>
 
 	* configure.ac (x86): Define LINUX for GNU/Linux systems.
diff -r c76ef1d3effe -r 53f948a9ded6 tests/cxx/t-ops2.cc
--- a/tests/cxx/t-ops2.cc	Wed Nov 30 00:50:44 2016 +0100
+++ b/tests/cxx/t-ops2.cc	Wed Nov 30 10:17:19 2016 +0100
@@ -110,7 +110,7 @@
   CHECK_ALL(mpz_class,6,3,^);
   CHECK(mpz_class,unsigned long,6,2,<<);
   CHECK(mpz_class,unsigned long,6,2,>>);
-  CHECK(mpz_class,unsigned long,-13,2,<<);
+  ASSERT_ALWAYS(mpz_class(-13)<<(unsigned long)2 == (-13)*4);
   CHECK(mpz_class,unsigned long,-13,2,>>);
   ASSERT_ALWAYS(++mpz_class(7)==8);
   ASSERT_ALWAYS(++mpz_class(-8)==-7);


More information about the gmp-commit mailing list