aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2018-02-05 01:43:24 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2018-02-05 01:43:24 +0000
commit91cb7f7804da1e4974e1e3589822e10910eeae20 (patch)
tree6f053e5ff47b5a0f74f5a52873db9e9992f38b12
parent6ac0aed81501d236ed456b54a85684ac03dde713 (diff)
downloadgcc-91cb7f7804da1e4974e1e3589822e10910eeae20.zip
gcc-91cb7f7804da1e4974e1e3589822e10910eeae20.tar.gz
gcc-91cb7f7804da1e4974e1e3589822e10910eeae20.tar.bz2
compiler: don't error for goto over type or const declaration
We should only issue 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. Fixes golang/go#19089 Reviewed-on: https://go-review.googlesource.com/91696 From-SVN: r257375
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/gogo.cc12
2 files changed, 10 insertions, 4 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 257ca95..a893731 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -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.
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc
index 04edb08..ab0c27b 100644
--- a/gcc/go/gofrontend/gogo.cc
+++ b/gcc/go/gofrontend/gogo.cc
@@ -6199,9 +6199,15 @@ Bindings_snapshot::check_goto_defs(Location loc, const Block* block,
}
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());
+ }
+ }
}
}