Hi! Seems 2 functions in varasm.c just use TREE_PUBLIC on LABEL_DECLs together with other kinds of decls, but as TREE_PUBLIC on LABEL_DECLs means now something different, it breaks badly. While I could change those 2 functions in varasm.c, I'm afraid other functions might be doing something similar, so I think TREE_PRIVATE which is used far less often is a better choice for the flag bit here.
Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk? 2016-10-12 Jakub Jelinek <ja...@redhat.com> PR c/77946 * tree.h (FALLTHROUGH_LABEL_P): Use private_flag instead of public_flag. * varasm.c (default_binds_local_p_3): Formatting fix. * c-c++-common/Wimplicit-fallthrough-34.c: New test. --- gcc/tree.h.jj 2016-10-11 20:50:53.000000000 +0200 +++ gcc/tree.h 2016-10-12 10:14:39.475938668 +0200 @@ -777,7 +777,7 @@ extern void omp_clause_range_check_faile /* Whether a case or a user-defined label is allowed to fall through to. This is used to implement -Wimplicit-fallthrough. */ #define FALLTHROUGH_LABEL_P(NODE) \ - (LABEL_DECL_CHECK (NODE)->base.public_flag) + (LABEL_DECL_CHECK (NODE)->base.private_flag) /* Nonzero means this expression is volatile in the C sense: its address should be of type `volatile WHATEVER *'. --- gcc/varasm.c.jj 2016-10-09 13:19:09.000000000 +0200 +++ gcc/varasm.c 2016-10-12 10:12:41.617430327 +0200 @@ -6856,8 +6856,8 @@ default_binds_local_p_3 (const_tree exp, FIXME: We can resolve the weakref case more curefuly by looking at the weakref alias. */ if (lookup_attribute ("weakref", DECL_ATTRIBUTES (exp)) - || (TREE_CODE (exp) == FUNCTION_DECL - && lookup_attribute ("ifunc", DECL_ATTRIBUTES (exp)))) + || (TREE_CODE (exp) == FUNCTION_DECL + && lookup_attribute ("ifunc", DECL_ATTRIBUTES (exp)))) return false; /* Static variables are always local. */ --- gcc/testsuite/c-c++-common/Wimplicit-fallthrough-34.c.jj 2016-10-12 10:19:30.726252500 +0200 +++ gcc/testsuite/c-c++-common/Wimplicit-fallthrough-34.c 2016-10-12 10:19:06.000000000 +0200 @@ -0,0 +1,12 @@ +/* PR c/77946 */ +/* { dg-do compile } */ +/* { dg-options "-Wimplicit-fallthrough" } */ + +void +foo (void) +{ + static void *p = &&lab; + goto *p; + /*FALLTHRU*/ + lab:; +} Jakub