This is the same issue as PR96818. It's another intersect that's
missing a cast in the same function. I missed it in the previous PR.
Pushed as obvious.
PR tree-optimization/96967
* tree-vrp.c (find_case_label_range): Cast label range to
type of switch operand.
---
gcc/testsuite/gcc.dg/tree-ssa/pr96967.c | 36
+++++++++++++++++++++++++++++++++
gcc/tree-vrp.c | 2 ++
2 files changed, 38 insertions(+)
create mode 100644 gcc/testsuite/gcc.dg/tree-ssa/pr96967.c
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr96967.c
b/gcc/testsuite/gcc.dg/tree-ssa/pr96967.c
new file mode 100644
index 0000000..249dfc7
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/tree-ssa/pr96967.c
@@ -0,0 +1,36 @@
+/* { dg-do compile } */
+/* { dg-options "-O2 -fshort-enums" } */
+
+enum re {
+ o3,
+};
+
+int
+uj (int mq, enum re dn)
+{
+ enum re nr = mq;
+
+ switch (nr)
+ {
+ case 4:
+ if (dn == 0)
+ goto wdev_inactive_unlock;
+ break;
+
+ default:
+ break;
+ }
+
+ switch (nr)
+ {
+ case 0:
+ case 4:
+ return 0;
+
+ default:
+ break;
+ }
+
+ wdev_inactive_unlock:
+ return 1;
+}
diff --git a/gcc/tree-vrp.c b/gcc/tree-vrp.c
index f7b0692..b493e40 100644
--- a/gcc/tree-vrp.c
+++ b/gcc/tree-vrp.c
@@ -3828,6 +3828,8 @@ find_case_label_range (gswitch *switch_stmt, const
irange *range_of_op)
tree case_high
= CASE_HIGH (label) ? CASE_HIGH (label) : CASE_LOW (label);
int_range_max label_range (CASE_LOW (label), case_high);
+ if (!types_compatible_p (label_range.type (), range_of_op->type ()))
+ range_cast (label_range, range_of_op->type ());
label_range.intersect (range_of_op);
if (label_range == *range_of_op)
return label;
--
1.8.3.1