aboutsummaryrefslogtreecommitdiff
path: root/gcc/go
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2015-09-10 03:46:03 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2015-09-10 03:46:03 +0000
commit609df8a305e7d4a8325348078ba8d71638a3db25 (patch)
treed2f088980e371b7decedce6bb5a235cd722f2390 /gcc/go
parentc41963bbcea87405e04ef59efa7b3226529b42d8 (diff)
downloadgcc-609df8a305e7d4a8325348078ba8d71638a3db25.zip
gcc-609df8a305e7d4a8325348078ba8d71638a3db25.tar.gz
gcc-609df8a305e7d4a8325348078ba8d71638a3db25.tar.bz2
compiler: Don't allow shifts with non-integers.
Fixes golang/go#11616. Reviewed-on: https://go-review.googlesource.com/13688 From-SVN: r227604
Diffstat (limited to 'gcc/go')
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/expressions.cc6
2 files changed, 7 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 9dea1f8..a4ec924 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -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.
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index 5abfb27..21b4f14 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -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)