+2004-12-16 Roger Sayle <roger@eyesopen.com>
+
+ PR middle-end/18493
+ * c-typeck.c (c_finish_case): Rechain statements if we didn't
+ encounter any case labels or a default.
+
2004-12-16 Eric Botcazou <ebotcazou@adacore.com>
PR middle-end/18882
{
struct c_switch *cs = switch_stack;
+ /* If we've not seen any case labels (or a default), we may still
+ need to chain any statements that were seen as the SWITCH_BODY. */
+ if (SWITCH_BODY (cs->switch_stmt) == NULL)
+ {
+ SWITCH_BODY (cs->switch_stmt) = TREE_CHAIN (cs->switch_stmt);
+ TREE_CHAIN (cs->switch_stmt) = NULL_TREE;
+ }
+
/* Rechain the next statements to the SWITCH_STMT. */
last_tree = cs->switch_stmt;
+2004-12-16 Roger Sayle <roger@eyesopen.com>
+
+ PR middle-end/18493
+ * gcc.dg/switch-4.c: New test case.
+
2004-12-16 Wolfgang Bangerth <bangerth@dealii.com>
* g++.dg/other/complex1.C: New test.
-/* PR middle-end/17657 */
-/* { dg-do compile } */
-/* { dg-options "-O2" } */
+/* PR middle-end/18493 */
+/* { dg-do link } */
-extern signed char foo(int);
-
-void bar (void)
-{
- signed char tmp = foo (0);
- int t1 = tmp;
- switch (t1)
- {
- case 1: foo (1); break;
- case 2: foo (2); break;
- case 3: foo (3); break;
- case 4: foo (4); break;
- case 5: foo (5); break;
- case 6: foo (6); break;
- case 7: foo (7); break;
- case 255: foo (8); break;
- default: break;
- }
+int main() {
+goto bug;
+switch(0) {
+bug: return 0;
+}
}