diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-10-20 18:14:30 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2015-10-20 18:14:30 +0000 |
commit | 28c64f64a40843a5951225a2c5949f21a6bc15b4 (patch) | |
tree | 0d598261823b603990969463f0781fc713573c1f /gcc | |
parent | 51090a412a665305192e7a05b96bb753b02f591e (diff) | |
download | gcc-28c64f64a40843a5951225a2c5949f21a6bc15b4.zip gcc-28c64f64a40843a5951225a2c5949f21a6bc15b4.tar.gz gcc-28c64f64a40843a5951225a2c5949f21a6bc15b4.tar.bz2 |
compiler: Report errors for non-integral shift counts.
Fixes golang/go#12618.
Reviewed-on: https://go-review.googlesource.com/14647
From-SVN: r229096
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | gcc/go/gofrontend/expressions.cc | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index dda0032..d184a43 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -a4bcd319d98ddc52b3e7d16ec87d92aad868ab05 +302d8abbc499e28088d758ae8b2c024d8e50b9b3 The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 80f8b4c..20ca10b 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")); |