This patch from Chris Manghane makes empty interface types for
variables at parse time when there are no methods.  This is normally
cleaned up later, but for sink variables that clean up never happens
and we get an internal compiler error.  This fixes
https://golang.org/issue/11579.  Bootstrapped and ran Go testsuite on
x86_64-unknown-linux-gnu.  Committed to mainline.

Ian
Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE     (revision 226122)
+++ gcc/go/gofrontend/MERGE     (working copy)
@@ -1,4 +1,4 @@
-b4a932b4a51b612cadcec93a83f94d6ee7d7d190
+cbb27e8089e11094a20502e53ef69c9c36955f85
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: gcc/go/gofrontend/parse.cc
===================================================================
--- gcc/go/gofrontend/parse.cc  (revision 225750)
+++ gcc/go/gofrontend/parse.cc  (working copy)
@@ -1225,7 +1225,11 @@ Parse::interface_type(bool record)
       methods = NULL;
     }
 
-  Interface_type* ret = Type::make_interface_type(methods, location);
+  Interface_type* ret;
+  if (methods == NULL)
+    ret = Type::make_empty_interface_type(location);
+  else
+    ret = Type::make_interface_type(methods, location);
   if (record)
     this->gogo_->record_interface_type(ret);
   return ret;

Reply via email to