+2016-05-31 Marek Polacek <polacek@redhat.com>
+
+ * gimplify.c (gimplify_switch_expr): Also handle GIMPLE_TRY.
+
2016-05-31 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
* config/aarch64/aarch64.c (aarch_macro_fusion_pair_p): Use
while (gimple_code (seq) == GIMPLE_BIND)
seq = gimple_bind_body (as_a <gbind *> (seq));
gimple *stmt = gimple_seq_first_stmt (seq);
- enum gimple_code code = gimple_code (stmt);
- if (code != GIMPLE_LABEL && code != GIMPLE_TRY)
+ if (gimple_code (stmt) == GIMPLE_TRY)
{
- if (code == GIMPLE_GOTO
+ /* A compiler-generated cleanup or a user-written try block.
+ Try to get the first statement in its try-block, for better
+ location. */
+ if ((seq = gimple_try_eval (stmt)))
+ stmt = gimple_seq_first_stmt (seq);
+ }
+ if (gimple_code (stmt) != GIMPLE_LABEL)
+ {
+ if (gimple_code (stmt) == GIMPLE_GOTO
&& TREE_CODE (gimple_goto_dest (stmt)) == LABEL_DECL
&& DECL_ARTIFICIAL (gimple_goto_dest (stmt)))
/* Don't warn for compiler-generated gotos. These occur
+2016-05-31 Marek Polacek <polacek@redhat.com>
+
+ * c-c++-common/Wswitch-unreachable-3.c: New test.
+ * g++.dg/warn/Wswitch-unreachable-1.C: New test.
+
2016-05-31 Richard Biener <rguenther@suse.de>
PR tree-optimization/71352
--- /dev/null
+/* { dg-do compile } */
+
+extern void f (int *);
+
+void
+g (int i)
+{
+ switch (i)
+ {
+ int a[3];
+ __builtin_memset (a, 0, sizeof a); /* { dg-warning "statement will never be executed" } */
+
+ default:
+ f (a);
+ }
+
+ switch (i)
+ {
+ int a[3];
+ int b[3];
+ int c[3];
+ b[1] = 60; /* { dg-warning "statement will never be executed" } */
+
+ default:
+ f (a);
+ f (b);
+ f (c);
+ }
+}