diff options
author | Richard Sandiford <richard.sandiford@linaro.org> | 2017-12-20 12:50:35 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2017-12-20 12:50:35 +0000 |
commit | 27d229f709a928adc7c4e464509cc1633d127f3f (patch) | |
tree | 62059d7d943b688c666005fafa1ce3030be33105 /gcc | |
parent | f4dd468f5300633d1e40921bf5e910d8a46d1d74 (diff) | |
download | gcc-27d229f709a928adc7c4e464509cc1633d127f3f.zip gcc-27d229f709a928adc7c4e464509cc1633d127f3f.tar.gz gcc-27d229f709a928adc7c4e464509cc1633d127f3f.tar.bz2 |
Fix multiple_p for two non-poly_ints
Fix a stupid inversion. This function is very rarely used and was
mostly to help split patches up, which is why it didn't get picked
up during initial testing.
2017-12-20 Richard Sandiford <richard.sandiford@linaro.org>
gcc/
* poly-int.h (multiple_p): Fix handling of two non-poly_ints.
gcc/testsuite/
* gcc.dg/plugin/poly-int-tests.h (test_nonpoly_multiple_p): New
function.
(test_nonpoly_type): Call it.
From-SVN: r255860
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/poly-int.h | 2 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/testsuite/gcc.dg/plugin/poly-int-tests.h | 14 |
4 files changed, 25 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 2a44580..fae3d38 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,7 @@ +2017-12-20 Richard Sandiford <richard.sandiford@linaro.org> + + * poly-int.h (multiple_p): Fix handling of two non-poly_ints. + 2017-12-20 Kyrylo Tkachov <kyrylo.tkachov@arm.com> * doc/invoke.texi (ARM Options): Document accepted extension options diff --git a/gcc/poly-int.h b/gcc/poly-int.h index 68788d7..d91244b 100644 --- a/gcc/poly-int.h +++ b/gcc/poly-int.h @@ -2027,7 +2027,7 @@ template<typename Ca, typename Cb> inline typename if_nonpoly2<Ca, Cb, bool>::type multiple_p (Ca a, Cb b) { - return a % b != 0; + return a % b == 0; } /* Return true if A is a (polynomial) multiple of B. */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c9a03a6..76f1b79 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-12-20 Richard Sandiford <richard.sandiford@linaro.org> + + * gcc.dg/plugin/poly-int-tests.h (test_nonpoly_multiple_p): New + function. + (test_nonpoly_type): Call it. + 2017-12-20 Jakub Jelinek <jakub@redhat.com> PR c++/83490 diff --git a/gcc/testsuite/gcc.dg/plugin/poly-int-tests.h b/gcc/testsuite/gcc.dg/plugin/poly-int-tests.h index b195f67..4fb32cd 100644 --- a/gcc/testsuite/gcc.dg/plugin/poly-int-tests.h +++ b/gcc/testsuite/gcc.dg/plugin/poly-int-tests.h @@ -4505,6 +4505,19 @@ test_uhwi () wi::uhwi (210, 16))); } +/* Test multiple_p for non-polynomial T. */ + +template<typename T> +static void +test_nonpoly_multiple_p () +{ + ASSERT_TRUE (multiple_p (T (6), T (2))); + ASSERT_TRUE (multiple_p (T (6), T (3))); + ASSERT_FALSE (multiple_p (T (6), T (4))); + ASSERT_FALSE (multiple_p (T (7), T (4))); + ASSERT_TRUE (multiple_p (T (8), T (4))); +} + /* Test known_size_p for non-polynomial T. */ template<typename T> @@ -4523,6 +4536,7 @@ template<typename T> static void test_nonpoly_type () { + test_nonpoly_multiple_p<T> (); test_nonpoly_known_size_p<T> (); } |