Commit 337fe413 authored by Russ Cox's avatar Russ Cox

cmd/gc: make runtime escape an error, not a fatal error

It is more useful to report all the errors instead of just the first.

LGTM=dave, khr
R=khr, dave
CC=golang-codereviews
https://golang.org/cl/143940043
parent c3dbf56a
...@@ -585,7 +585,7 @@ cgen_dcl(Node *n) ...@@ -585,7 +585,7 @@ cgen_dcl(Node *n)
if(!(n->class & PHEAP)) if(!(n->class & PHEAP))
return; return;
if(compiling_runtime) if(compiling_runtime)
fatal("%N escapes to heap, not allowed in runtime.", n); yyerror("%N escapes to heap, not allowed in runtime.", n);
if(n->alloc == nil) if(n->alloc == nil)
n->alloc = callnew(n->type); n->alloc = callnew(n->type);
cgen_as(n->heapaddr, n->alloc); cgen_as(n->heapaddr, n->alloc);
......
...@@ -2505,7 +2505,7 @@ paramstoheap(Type **argin, int out) ...@@ -2505,7 +2505,7 @@ paramstoheap(Type **argin, int out)
// generate allocation & copying code // generate allocation & copying code
if(compiling_runtime) if(compiling_runtime)
fatal("%N escapes to heap, not allowed in runtime.", v); yyerror("%N escapes to heap, not allowed in runtime.", v);
if(v->alloc == nil) if(v->alloc == nil)
v->alloc = callnew(v->type); v->alloc = callnew(v->type);
nn = list(nn, nod(OAS, v->heapaddr, v->alloc)); nn = list(nn, nod(OAS, v->heapaddr, v->alloc));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment