https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96818

Aldy Hernandez <aldyh at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING

--- Comment #5 from Aldy Hernandez <aldyh at gcc dot gnu.org> ---
I would still like to get to the root of the problem, but in the meantime we
could easily hack around it by casting the label range to the switch operand
type (or is it the other way around per language rules?):

diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index 8c1a1854daa..434ddcdd6ed 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -3850,6 +3850,7 @@ find_case_label_range (gswitch *switch_stmt, const irange
*range_of_op)
       if (!case_high)
        case_high = CASE_LOW (max_label);
       widest_irange label_range (CASE_LOW (min_label), case_high);
+      range_cast (label_range, range_of_op->type ());
       label_range.intersect (range_of_op);
       if (label_range.undefined_p ())
        return gimple_switch_label (switch_stmt, 0);

Reply via email to