On 05/20/2016 06:36 PM, Marek Polacek wrote:
--- gcc/gimplify.c
+++ gcc/gimplify.c
@@ -1595,6 +1595,32 @@ gimplify_switch_expr (tree *expr_p, gimple_seq *pre_p)
       gimplify_ctxp->case_labels.create (8);

       gimplify_stmt (&SWITCH_BODY (switch_expr), &switch_body_seq);
+
+      /* Possibly warn about unreachable statements between switch's
+        controlling expression and the first case.  */
+      if (warn_switch_unreachable
+         /* This warning doesn't play well with Fortran when optimizations
+            are on.  */
+         && !lang_GNU_Fortran ()
+         && switch_body_seq != NULL)

Does this still make the warning dependent on the optimization level and the target?

Can we document what a programmer needs to do to suppress the warning? My worry is that the warning will be too unpredictable to be useful.

Thanks,
Florian

Reply via email to