The gccgo parser had a bug: it rejected labels on fallthrough statements, because those statements can only appear in specific contexts (at the end of a switch block just before the next case statement). This patch fixes the problem. I will add a test to the master testsuite for this, which will be brought into the gccgo testsuite in due course (https://go-review.googlesource.com/7523). Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline.
Ian
diff -r 52642b1b9500 go/parse.cc --- a/go/parse.cc Fri Mar 13 11:52:24 2015 -0700 +++ b/go/parse.cc Fri Mar 13 13:43:52 2015 -0700 @@ -3735,6 +3735,17 @@ if (!this->statement_may_start_here()) { + if (this->peek_token()->is_keyword(KEYWORD_FALLTHROUGH)) + { + // We don't treat the fallthrough keyword as a statement, + // because it can't appear most places where a statement is + // permitted, but it may have a label. We introduce a + // semicolon because the caller expects to see a statement. + this->unget_token(Token::make_operator_token(OPERATOR_SEMICOLON, + location)); + return; + } + // Mark the label as used to avoid a useless error about an // unused label. if (label != NULL)