compiler: don't report runtime escapes if we've seen errors

If we get errors during compilation, we skip the escape analysis pass.
If we are compiling the runtime package, we report an error if a bound
method expression escapes.  The effect is that if we get an error
while compiling the runtime package, we would report confusing and
meaningless errors about bound method expressions escaping.

This CL stops doing that.

Change-Id: I3d5f413c6fe2c48f90439f845e7be18db23e124e
Reviewed-by: Cherry Zhang <>
diff --git a/go/ b/go/
index 939a5f7..4db4e4a 100644
--- a/go/
+++ b/go/
@@ -7948,7 +7948,9 @@
   Node* n = Node::make_node(this);
   if ((n->encoding() & ESCAPE_MASK) == Node::ESCAPE_NONE)
-  else if (gogo->compiling_runtime() && gogo->package_name() == "runtime")
+  else if (gogo->compiling_runtime()
+	   && gogo->package_name() == "runtime"
+	   && !saw_errors())
     go_error_at(loc, "%s escapes to heap, not allowed in runtime",