From 2a7ba9243eec646d7aa4adae3b4b867a689251f2 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 14 Sep 2018 16:55:41 +0000 Subject: 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 --- gcc/go/gofrontend/parse.cc | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'gcc/go/gofrontend/parse.cc') 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); -- cgit v1.1