summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2011-03-25 19:23:10 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-03-25 19:23:10 +0000
commit7657ab90b46149b27703a397f3764ef9517eb988 (patch)
tree22b7104a112444a970a590843a98772767f2858e
parentba78087b6c12fa4e3ab9d6b10c074624daec20ce (diff)
downloadgcc-7657ab90b46149b27703a397f3764ef9517eb988.tar.gz
Avoid overflow error after negative shift count error.
From-SVN: r171523
-rw-r--r--gcc/go/gofrontend/expressions.cc8
1 files changed, 7 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index 861d5c0ca99..2ee4a696db9 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -5747,7 +5747,13 @@ Binary_expression::do_check_types(Gogo*)
if (this->right_->integer_constant_value(true, val, &type))
{
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);
}