summaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2020-01-08 00:38:00 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2020-01-08 00:38:00 +0000
commitfc6dbd584b4aa5c93ddaf52a62d4293a5e497a90 (patch)
tree35b3eff5e5a9e26e79ab8b26d37dcd86a678122b /gcc/go
parentfd9ca4c64676a0fac332092285cb78918a2cdb11 (diff)
compiler: fix loopdepth tracking in array slicing expression in escape analysis
In the gc compiler, for slicing an array, its AST has an implicit address operation node. There isn't such node in the gofrontend AST. During the escape analysis, we create a fake node to mimic the gc compiler's behavior. For the fake node, the loopdepth was not tracked correctly, causing miscompilation. Since this is an address operation, do the same thing as we do for the address operator. Fixes golang/go#36404. Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/213643 From-SVN: r279984
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/escape.cc3
2 files changed, 3 insertions, 2 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index fbba6626cc4..d993dc89d3e 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-6fa9657df508ff4d7760cf1abfad3611ba808561
+e0790a756e9ba77e2d3d6ef5d0abbb11dd71211b
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/escape.cc b/gcc/go/gofrontend/escape.cc
index f8e07f73cd2..0d38858897d 100644
--- a/gcc/go/gofrontend/escape.cc
+++ b/gcc/go/gofrontend/escape.cc
@@ -1906,7 +1906,8 @@ Escape_analysis_assign::expression(Expression** pexpr)
this->context_->track(addr_node);
Node::Escape_state* addr_state = addr_node->state(this->context_, NULL);
- addr_state->loop_depth = array_state->loop_depth;
+ if (array_state->loop_depth != 0)
+ addr_state->loop_depth = array_state->loop_depth;
}
}
break;