Skip to content

Commit

Permalink
compiler: Report errors for non-integral shift counts.
Browse files Browse the repository at this point in the history
    
    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
  • Loading branch information
ian committed Oct 20, 2015
1 parent 885c11f commit 6b5e0fa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gcc/go/gofrontend/MERGE
Original file line number Diff line number Diff line change
@@ -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.
4 changes: 3 additions & 1 deletion gcc/go/gofrontend/expressions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down

0 comments on commit 6b5e0fa

Please sign in to comment.