From 7657ab90b46149b27703a397f3764ef9517eb988 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 25 Mar 2011 19:23:10 +0000 Subject: [PATCH] Avoid overflow error after negative shift count error. From-SVN: r171523 --- gcc/go/gofrontend/expressions.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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); } -- 2.30.2