PR c/10178
* stmt.c (expand_end_case_type): Check for overflow in range when
determining whether to use a bit-test implementation.
* gcc.c-torture/compile/
20030323-1.c: New test case.
From-SVN: r64757
+2003-03-23 Roger Sayle <roger@eyesopen.com>
+
+ PR c/10178
+ * stmt.c (expand_end_case_type): Check for overflow in range when
+ determining whether to use a bit-test implementation.
+
2003-03-23 Richard Henderson <rth@redhat.com>
* cfgcleanup.c (try_optimize_cfg): Allow merging of tablejumps
else if (CASE_USE_BIT_TESTS
&& ! TREE_CONSTANT (index_expr)
&& compare_tree_int (range, GET_MODE_BITSIZE (word_mode)) < 0
+ && compare_tree_int (range, 0) > 0
&& lshift_cheap_p ()
&& ((uniq == 1 && count >= 3)
|| (uniq == 2 && count >= 5)
+2003-03-23 Roger Sayle <roger@eyesopen.com>
+
+ * gcc.c-torture/compile/20030323-1.c: New test case.
+
2003-03-22 Ulrich Weigand <uweigand@de.ibm.com>
* gcc.dg/20030321-1.c: New test.
--- /dev/null
+/* PR c/10178. The following code would ICE because we didn't check for
+ overflow when computing the range of the switch-statment, and therefore
+ decided it could be implemented using bit-tests. */
+
+int
+banana(long citron)
+{
+ switch (citron) {
+ case 0x80000000:
+ case 0x40000:
+ case 0x40001:
+ return 1;
+ break;
+ }
+ return 0;
+}
+