compiler: Don't allow shifts with non-integers.
authorIan Lance Taylor <ian@gcc.gnu.org>
Thu, 10 Sep 2015 03:46:03 +0000 (03:46 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Thu, 10 Sep 2015 03:46:03 +0000 (03:46 +0000)
    Fixes golang/go#11616.

    Reviewed-on: https://go-review.googlesource.com/13688

From-SVN: r227604

gcc/go/gofrontend/MERGE
gcc/go/gofrontend/expressions.cc

index 9dea1f84115a17f26507e46e63151fca2ba2ad9f..a4ec9249bf7fa05e79cea099533a52f2c34882b9 100644 (file)
@@ -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.
index 5abfb27b3f1c8b6dd6057e7a0060683e2b2405c6..21b4f143b778448310f6f7f57d1fe3ddf395ad67 100644 (file)
@@ -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)