This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug middle-end/71654] [6/7 Regression] missing VRP optimization on c++ unsigned char and short expressions


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))))

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]