Go patch committed: Don't report runtime escapes if we've seen errors

Message ID CAOyqgcUThJV9Go79QXAt4H-r1f3UFT-g6oN++V-Uio0tP8qdGA@mail.gmail.com
State New
Headers show
  • Go patch committed: Don't report runtime escapes if we've seen errors
Related show

Commit Message

Ian Lance Taylor Aug. 31, 2019, 2:57 a.m.
If we get errors during a Go 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 patch stops doing that.

Bootstrapped and ran Go tests on x86_64-pc-linux-gnu.  Committed to mainline.



Index: gcc/go/gofrontend/MERGE
--- gcc/go/gofrontend/MERGE	(revision 275237)
+++ 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/expressions.cc
--- gcc/go/gofrontend/expressions.cc	(revision 274998)
+++ gcc/go/gofrontend/expressions.cc	(working copy)
@@ -7948,7 +7948,9 @@  Bound_method_expression::do_flatten(Gogo
   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",