2019-05-15 Martin Liska <mliska@suse.cz>
PR middle-end/90478
* tree-switch-conversion.c (jump_table_cluster::can_be_handled):
Check for overflow.
2019-05-15 Martin Liska <mliska@suse.cz>
PR middle-end/90478
* gcc.dg/tree-ssa/pr90478-2.c: New test.
* gcc.dg/tree-ssa/pr90478.c: New test.
From-SVN: r271210
+2019-05-15 Martin Liska <mliska@suse.cz>
+
+ PR middle-end/90478
+ * tree-switch-conversion.c (jump_table_cluster::can_be_handled):
+ Check for overflow.
+
2019-05-15 Richard Biener <rguenther@suse.de>
* tree-into-ssa.c (pass_build_ssa::execute): Run
+2019-05-15 Martin Liska <mliska@suse.cz>
+
+ PR middle-end/90478
+ * gcc.dg/tree-ssa/pr90478-2.c: New test.
+ * gcc.dg/tree-ssa/pr90478.c: New test.
+
2019-05-15 Richard Biener <rguenther@suse.de>
* gcc.dg/gimplefe-40.c: Amend.
--- /dev/null
+/* { dg-do compile } */
+/* { dg-options "-Os --param jump-table-max-growth-ratio-for-size=2147483647" } */
+
+long
+foo (long x, long y)
+{
+ x = x & y;
+ switch (y)
+ {
+ case 63L: x >>= 0; break;
+ case 4032L: x >>= 6; break;
+ case 258048L: x >>= 12; break;
+ case 16515072L: x >>= 18; break;
+ default: __builtin_unreachable ();
+ }
+ return x;
+}
--- /dev/null
+/* { dg-do compile } */
+
+typedef struct {
+ long a;
+} c;
+
+void e();
+
+void d() {
+ c *b;
+ switch (b->a)
+ case 8:
+ case 2:
+ case 2057594037927936:
+ case 0:
+ case 4611686018427387904:
+ e();
+}
comparison_count += sc->m_range_p ? 2 : 1;
}
- return 100 * range <= max_ratio * comparison_count;
+ unsigned HOST_WIDE_INT lhs = 100 * range;
+ if (lhs < range)
+ return false;
+
+ return lhs <= max_ratio * comparison_count;
}
/* Return true if cluster starting at START and ending at END (inclusive)