diff options
author | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-10-23 19:16:53 +0000 |
---|---|---|
committer | law <law@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-10-23 19:16:53 +0000 |
commit | e57d9243f9be791ddf50d88362cc4efafd20656a (patch) | |
tree | de244e9c75eefeef6b1158112ed8ee8c63e19a8f /gcc/match.pd | |
parent | 02f43d0e52d848f900cd0cb89208ebc0e5c49829 (diff) | |
download | gcc-e57d9243f9be791ddf50d88362cc4efafd20656a.tar.gz |
[RFA] Fix pr67830, another type narrowing problem
PR tree-optimization/67830
* match.pd ((bit_and (plus/minus (convert @0) (convert @1)) mask)):
Explicitly verify the mask has no bits outside the type of
the innermost operands.
PR tree-optimization/67830
* gcc.dg/pr67830.c: New test.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229267 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/match.pd')
-rw-r--r-- | gcc/match.pd | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/gcc/match.pd b/gcc/match.pd index d182f68f4a4..d6ab94ecf6f 100644 --- a/gcc/match.pd +++ b/gcc/match.pd @@ -2719,8 +2719,8 @@ along with GCC; see the file COPYING3. If not see && types_match (@0, @1) && (tree_int_cst_min_precision (@4, TYPE_SIGN (TREE_TYPE (@0))) <= TYPE_PRECISION (TREE_TYPE (@0))) - && (TYPE_OVERFLOW_WRAPS (TREE_TYPE (@0)) - || tree_int_cst_sgn (@4) >= 0)) + && (wi::bit_and (@4, wi::mask (TYPE_PRECISION (TREE_TYPE (@0)), + true, TYPE_PRECISION (type))) == 0)) (if (TYPE_OVERFLOW_WRAPS (TREE_TYPE (@0))) (with { tree ntype = TREE_TYPE (@0); } (convert (bit_and (op @0 @1) (convert:ntype @4)))) |