Skip to content

Commit 85334a2

Browse files
author
ian
committed
compiler: Don't allow shifts with non-integers.
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
1 parent f6f4600 commit 85334a2

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

gcc/go/gofrontend/MERGE

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
672ac2abc52d8bd70cb9fb03dd4a32fdde9c438f
1+
913b47c957ea91db2f724491d88cb20e8f9be8c7
22

33
The first line of this file holds the git revision number of the last
44
merge done from the gofrontend repository.

gcc/go/gofrontend/expressions.cc

+6
Original file line numberDiff line numberDiff line change
@@ -4523,6 +4523,12 @@ Binary_expression::eval_constant(Operator op, Numeric_constant* left_nc,
45234523
return false;
45244524
if (!is_shift && !right_nc->set_type(type, true, location))
45254525
return false;
4526+
if (is_shift
4527+
&& ((left_type->integer_type() == NULL
4528+
&& !left_type->is_abstract())
4529+
|| (right_type->integer_type() == NULL
4530+
&& !right_type->is_abstract())))
4531+
return false;
45264532

45274533
bool r;
45284534
if (type->complex_type() != NULL)

0 commit comments

Comments
 (0)