Commit 7657ab90 by Ian Lance Taylor

Avoid overflow error after negative shift count error.

From-SVN: r171523
parent ba78087b
...@@ -5747,7 +5747,13 @@ Binary_expression::do_check_types(Gogo*) ...@@ -5747,7 +5747,13 @@ Binary_expression::do_check_types(Gogo*)
if (this->right_->integer_constant_value(true, val, &type)) if (this->right_->integer_constant_value(true, val, &type))
{ {
if (mpz_sgn(val) < 0) if (mpz_sgn(val) < 0)
this->report_error(_("negative shift count")); {
this->report_error(_("negative shift count"));
mpz_set_ui(val, 0);
source_location rloc = this->right_->location();
this->right_ = Expression::make_integer(&val, right_type,
rloc);
}
} }
mpz_clear(val); mpz_clear(val);
} }
......
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