Commit fc6dbd58 by Ian Lance Taylor

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
parent fd9ca4c6
6fa9657df508ff4d7760cf1abfad3611ba808561
e0790a756e9ba77e2d3d6ef5d0abbb11dd71211b
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment