Skip to content

Commit

Permalink
compiler: Don't make temporaries for constant operands.
Browse files Browse the repository at this point in the history
    
    Fixes golang/go#12616.
    
    Reviewed-on: https://go-review.googlesource.com/14645

From-SVN: r228578
  • Loading branch information
Ian Lance Taylor committed Oct 7, 2015
1 parent cba9c78 commit 65f52d9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gcc/go/gofrontend/MERGE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
651e71a729e5dcbd9dc14c1b59b6eff05bfe3d26
a4bcd319d98ddc52b3e7d16ec87d92aad868ab05

The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
4 changes: 2 additions & 2 deletions gcc/go/gofrontend/expressions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5200,13 +5200,13 @@ Binary_expression::do_flatten(Gogo* gogo, Named_object*,
|| (is_idiv_op
&& (gogo->check_divide_by_zero() || gogo->check_divide_overflow())))
{
if (!this->left_->is_variable())
if (!this->left_->is_variable() && !this->left_->is_constant())
{
temp = Statement::make_temporary(NULL, this->left_, loc);
inserter->insert(temp);
this->left_ = Expression::make_temporary_reference(temp, loc);
}
if (!this->right_->is_variable())
if (!this->right_->is_variable() && !this->right_->is_constant())
{
temp =
Statement::make_temporary(NULL, this->right_, loc);
Expand Down

0 comments on commit 65f52d9

Please sign in to comment.