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. Sorry for the mistake.
Tested on aarch64-linux-gnu, x86_64-linux-gnu and powerpc64-linux-gnu. Applied as obvious. Richard 2017-12-20 Richard Sandiford <richard.sandif...@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. Index: gcc/poly-int.h =================================================================== --- gcc/poly-int.h 2017-12-20 08:55:30.768462429 +0000 +++ gcc/poly-int.h 2017-12-20 08:55:55.911492315 +0000 @@ -2027,7 +2027,7 @@ constant_multiple_p (const poly_int_pod< 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. */ Index: gcc/testsuite/gcc.dg/plugin/poly-int-tests.h =================================================================== --- gcc/testsuite/gcc.dg/plugin/poly-int-tests.h 2017-12-14 00:05:54.955021396 +0000 +++ gcc/testsuite/gcc.dg/plugin/poly-int-tests.h 2017-12-20 08:55:55.912492276 +0000 @@ -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 @@ test_nonpoly_known_size_p () static void test_nonpoly_type () { + test_nonpoly_multiple_p<T> (); test_nonpoly_known_size_p<T> (); }