In Go it's possible to construct an lshift expression using
unsafe.Sizeof that is technically a compile-time constant but can't be
evaluated without going through backend methods.  This patch by Than
McIntosh ensures that in this case Type::make_non_abstract_type is
called on the numeric operand of the shift (as opposed to leaving as
abstract), to avoid an assert later on in the compiler flow.  This
fixes  Bootstrapped and ran Go
testsuite on x86_64-pc-linux-gnu.  Committed to mainline.

Index: gcc/go/gofrontend/MERGE
--- gcc/go/gofrontend/MERGE     (revision 250992)
+++ gcc/go/gofrontend/MERGE     (working copy)
@@ -1,4 +1,4 @@
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: gcc/go/gofrontend/
--- gcc/go/gofrontend/    (revision 250873)
+++ gcc/go/gofrontend/    (working copy)
@@ -5655,7 +5655,7 @@ Binary_expression::do_determine_type(con
   Type_context subcontext(*context);
-  if (is_constant_expr)
+  if (is_constant_expr && !is_shift_op)
       subcontext.type = NULL;
       subcontext.may_be_abstract = true;

Reply via email to