diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-09-14 16:55:41 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2018-09-14 16:55:41 +0000 |
commit | 2a7ba9243eec646d7aa4adae3b4b867a689251f2 (patch) | |
tree | ed6dddd3d52e2444802907f0139d34e010c26ddc /gcc/go/gofrontend/parse.cc | |
parent | 98ef99ab97b84f526a401d8d96b9aca52c0daad7 (diff) | |
download | gcc-2a7ba9243eec646d7aa4adae3b4b867a689251f2.zip gcc-2a7ba9243eec646d7aa4adae3b4b867a689251f2.tar.gz gcc-2a7ba9243eec646d7aa4adae3b4b867a689251f2.tar.bz2 |
compiler: don't use address of temporary for deferred delete
This CL corrects the handling of a deferred delete in a loop, to not
use a temporary whose value will, at deferred execution time, wind up
being the last value in the loop.
The test for this is TestDeferDeleteSlow in the 1.11 runtime package.
Reviewed-on: https://go-review.googlesource.com/135358
From-SVN: r264325
Diffstat (limited to 'gcc/go/gofrontend/parse.cc')
-rw-r--r-- | gcc/go/gofrontend/parse.cc | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc index cc901db..6ed4377 100644 --- a/gcc/go/gofrontend/parse.cc +++ b/gcc/go/gofrontend/parse.cc @@ -4304,9 +4304,15 @@ Parse::go_or_defer_stat() this->gogo_->start_block(stat_location); Statement* stat; if (is_go) - stat = Statement::make_go_statement(call_expr, stat_location); + { + stat = Statement::make_go_statement(call_expr, stat_location); + call_expr->set_is_concurrent(); + } else - stat = Statement::make_defer_statement(call_expr, stat_location); + { + stat = Statement::make_defer_statement(call_expr, stat_location); + call_expr->set_is_deferred(); + } this->gogo_->add_statement(stat); this->gogo_->add_block(this->gogo_->finish_block(stat_location), stat_location); |