[Bug middle-end/71654] [6/7 Regression] missing VRP optimization on c++ unsigned char and short expressions
ppalka at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jun 28 22:21:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71654
Patrick Palka <ppalka at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ppalka at gcc dot gnu.org
--- Comment #2 from Patrick Palka <ppalka at gcc dot gnu.org> ---
Don't have the time to thoroughly test at the moment but this seems to fix it
on the VRP side:
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index c2115f4..1a0aa42 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -5298,7 +5298,7 @@ register_edge_assert_for_1 (tree name, edge e,
gimple_stmt_iterator bsi,
if (CONVERT_EXPR_CODE_P (rhs_code)
&& INTEGRAL_TYPE_P (TREE_TYPE (name2))
&& TYPE_UNSIGNED (TREE_TYPE (name2))
- && prec == TYPE_PRECISION (TREE_TYPE (name2))
+ && prec >= TYPE_PRECISION (TREE_TYPE (name2))
&& (comp_code == LE_EXPR || comp_code == GT_EXPR
|| !tree_int_cst_equal (val,
TYPE_MIN_VALUE (TREE_TYPE (val))))
More information about the Gcc-bugs
mailing list