This patch to the Go frontend fixes it to not issue an error for a
goto over a type or const declaration.  The frontend is only supposed
to issue such an error for a goto over a var declaration.  The test
case for this is already in the master repository, at
test/fixedbugs/issue8042.go.  It just hasn't been copied into the
gccgo repository yet.  This fixes https://golang.org/issue/19089.
Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
to mainline.

Ian
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE     (revision 257374)
+++ gcc/go/gofrontend/MERGE     (working copy)
@@ -1,4 +1,4 @@
-2f7ac42a3f83b78d97912ce1e86296b2af4f52b7
+0c8c4fca4b52bc2323561a432436af5343e0f7b4
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: gcc/go/gofrontend/gogo.cc
===================================================================
--- gcc/go/gofrontend/gogo.cc   (revision 257357)
+++ gcc/go/gofrontend/gogo.cc   (working copy)
@@ -6199,9 +6199,15 @@ Bindings_snapshot::check_goto_defs(Locat
        }
       go_assert(p != block->bindings()->end_definitions());
 
-      std::string n = (*p)->message_name();
-      go_error_at(loc, "goto jumps over declaration of %qs", n.c_str());
-      go_inform((*p)->location(), "%qs defined here", n.c_str());
+      for (; p != block->bindings()->end_definitions(); ++p)
+       {
+         if ((*p)->is_variable())
+           {
+             std::string n = (*p)->message_name();
+             go_error_at(loc, "goto jumps over declaration of %qs", n.c_str());
+             go_inform((*p)->location(), "%qs defined here", n.c_str());
+           }
+       }
     }
 }
 

Reply via email to