diff options
author | Jakub Jelinek <jakub@redhat.com> | 2019-09-11 10:33:55 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@gcc.gnu.org> | 2019-09-11 10:33:55 +0200 |
commit | 6d5093dad6a4927d23a914300605e76dd00c7a15 (patch) | |
tree | 2a3c8464e7a84791fc7d67aaa5319e7c48c8ca68 | |
parent | dc5b11916a2e318bd15d60f6cfd01d1e306ffbfb (diff) | |
download | gcc-6d5093dad6a4927d23a914300605e76dd00c7a15.zip gcc-6d5093dad6a4927d23a914300605e76dd00c7a15.tar.gz gcc-6d5093dad6a4927d23a914300605e76dd00c7a15.tar.bz2 |
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
-rw-r--r-- | gcc/ChangeLog | 6 | ||||
-rw-r--r-- | gcc/match.pd | 8 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr91725.c | 7 |
4 files changed, 23 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0aa93bc..360e606 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2019-09-11 Jakub Jelinek <jakub@redhat.com> + + 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 <rguenther@suse.de> Revert diff --git a/gcc/match.pd b/gcc/match.pd index 05009bb..5690cf3 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 8b3dfbb..8ef8062 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-09-11 Jakub Jelinek <jakub@redhat.com> + + PR middle-end/91725 + * gcc.c-torture/compile/pr91725.c: New test. + 2019-09-11 Richard Biener <rguenther@suse.de> 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 0000000..f614a1c --- /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); +} |