This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/71654] [6/7 Regression] missing VRP optimization on c++ unsigned char and short expressions
- From: "ppalka at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 28 Jun 2016 22:21:33 +0000
- Subject: [Bug middle-end/71654] [6/7 Regression] missing VRP optimization on c++ unsigned char and short expressions
- Auto-submitted: auto-generated
- References: <bug-71654-4 at http dot gcc dot gnu dot org/bugzilla/>
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))))