aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/gofrontend/parse.cc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2020-12-05 21:16:13 -0800
committerIan Lance Taylor <iant@golang.org>2020-12-08 10:22:12 -0800
commitf1b6e17b3f753980527721aa8e949d2481b2560b (patch)
tree1d9071fcfcbf9832e58b86f14812d4d017cdb654 /gcc/go/gofrontend/parse.cc
parentf41dd93ade24f22f8cd1863129ab20c821000134 (diff)
downloadgcc-f1b6e17b3f753980527721aa8e949d2481b2560b.zip
gcc-f1b6e17b3f753980527721aa8e949d2481b2560b.tar.gz
gcc-f1b6e17b3f753980527721aa8e949d2481b2560b.tar.bz2
compiler: use correct location for iota errors
Also check for valid array length when reducing len/cap to a constant. For golang/go#8183 Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/275654
Diffstat (limited to 'gcc/go/gofrontend/parse.cc')
-rw-r--r--gcc/go/gofrontend/parse.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc
index b1925ed..a4740cf 100644
--- a/gcc/go/gofrontend/parse.cc
+++ b/gcc/go/gofrontend/parse.cc
@@ -1442,6 +1442,7 @@ Parse::const_decl()
void
Parse::const_spec(int iota, Type** last_type, Expression_list** last_expr_list)
{
+ Location loc = this->location();
Typed_identifier_list til;
this->identifier_list(&til);
@@ -1466,7 +1467,11 @@ Parse::const_spec(int iota, Type** last_type, Expression_list** last_expr_list)
for (Expression_list::const_iterator p = (*last_expr_list)->begin();
p != (*last_expr_list)->end();
++p)
- expr_list->push_back((*p)->copy());
+ {
+ Expression* copy = (*p)->copy();
+ copy->set_location(loc);
+ expr_list->push_back(copy);
+ }
}
else
{