From: Jakub Jelinek Date: Wed, 11 Sep 2019 08:33:55 +0000 (+0200) Subject: re PR middle-end/91725 (ICE in get_nonzero_bits starting with r275587) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6d5093dad6a4927d23a914300605e76dd00c7a15;p=gcc.git re PR middle-end/91725 (ICE in get_nonzero_bits starting with r275587) PR middle-end/91725 * match.pd ((A / (1 << B)) -> (A >> B)): Call tree_nonzero_bits instead of get_nonzero_bits, only call it for integral types. * gcc.c-torture/compile/pr91725.c: New test. From-SVN: r275633 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0aa93bceb4b..360e606f47e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-09-11 Jakub Jelinek + + PR middle-end/91725 + * match.pd ((A / (1 << B)) -> (A >> B)): Call tree_nonzero_bits instead + of get_nonzero_bits, only call it for integral types. + 2019-09-11 Richard Biener Revert diff --git a/gcc/match.pd b/gcc/match.pd index 05009bb7a5a..5690cf3d349 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -325,9 +325,11 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT) && (TYPE_UNSIGNED (TREE_TYPE (@1)) || (element_precision (type) == element_precision (TREE_TYPE (@1))) - || (get_nonzero_bits (@0) - & wi::mask (element_precision (TREE_TYPE (@1)) - 1, true, - element_precision (type))) == 0)))) + || (INTEGRAL_TYPE_P (type) + && (tree_nonzero_bits (@0) + & wi::mask (element_precision (TREE_TYPE (@1)) - 1, + true, + element_precision (type))) == 0))))) (rshift @0 @2))) /* Preserve explicit divisions by 0: the C++ front-end wants to detect diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 8b3dfbbecf0..8ef80620c08 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-09-11 Jakub Jelinek + + PR middle-end/91725 + * gcc.c-torture/compile/pr91725.c: New test. + 2019-09-11 Richard Biener Revert diff --git a/gcc/testsuite/gcc.c-torture/compile/pr91725.c b/gcc/testsuite/gcc.c-torture/compile/pr91725.c new file mode 100644 index 00000000000..f614a1c5e32 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr91725.c @@ -0,0 +1,7 @@ +/* PR middle-end/91725 */ + +unsigned long long +foo (unsigned long long x, unsigned long long y, int z) +{ + return (x + y) / (1 << z); +}