From: ian Date: Fri, 25 Mar 2011 19:23:10 +0000 (+0000) Subject: Avoid overflow error after negative shift count error. X-Git-Tag: upstream/4.9.2~22001 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a4eba91bd30b463736e269e383ba8703d20d4627;p=platform%2Fupstream%2Flinaro-gcc.git Avoid overflow error after negative shift count error. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@171523 138bc75d-0d04-0410-961f-82ee72b054a4 --- diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 861d5c0..2ee4a69 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); }