Skip to content

Commit

Permalink
compiler: Don't allow shifts with non-integers.
Browse files Browse the repository at this point in the history
    
    Fixes golang/go#11616.
    
    Reviewed-on: https://go-review.googlesource.com/13688


git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@227604 138bc75d-0d04-0410-961f-82ee72b054a4
  • Loading branch information
ian committed Sep 10, 2015
1 parent f6f4600 commit 85334a2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion gcc/go/gofrontend/MERGE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
672ac2abc52d8bd70cb9fb03dd4a32fdde9c438f
913b47c957ea91db2f724491d88cb20e8f9be8c7

The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
6 changes: 6 additions & 0 deletions gcc/go/gofrontend/expressions.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4523,6 +4523,12 @@ Binary_expression::eval_constant(Operator op, Numeric_constant* left_nc,
return false;
if (!is_shift && !right_nc->set_type(type, true, location))
return false;
if (is_shift
&& ((left_type->integer_type() == NULL
&& !left_type->is_abstract())
|| (right_type->integer_type() == NULL
&& !right_type->is_abstract())))
return false;

bool r;
if (type->complex_type() != NULL)
Expand Down

0 comments on commit 85334a2

Please sign in to comment.