diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-10-20 18:14:30 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2015-10-20 18:14:30 +0000 |
commit | 6b5e0fac67dd1bdbdc86f2b70a350ea5cd841cf0 (patch) | |
tree | 0d598261823b603990969463f0781fc713573c1f /gcc/go/gofrontend/expressions.cc | |
parent | 885c11fb464a7928c95c63b76d5900baae3a0a60 (diff) | |
download | gcc-6b5e0fac67dd1bdbdc86f2b70a350ea5cd841cf0.tar.gz |
compiler: Report errors for non-integral shift counts.
Fixes golang/go#12618.
Reviewed-on: https://go-review.googlesource.com/14647
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@229096 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/go/gofrontend/expressions.cc')
-rw-r--r-- | gcc/go/gofrontend/expressions.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 80f8b4cbb27..20ca10b0524 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -5601,7 +5601,9 @@ Binary_expression::do_check_types(Gogo*) if (left_type->integer_type() == NULL) this->report_error(_("shift of non-integer operand")); - if (!right_type->is_abstract() + if (right_type->is_string_type()) + this->report_error(_("shift count not unsigned integer")); + else if (!right_type->is_abstract() && (right_type->integer_type() == NULL || !right_type->integer_type()->is_unsigned())) this->report_error(_("shift count not unsigned integer")); |