From d3229873aea34e4768d45cfa6a5ef50323fdf3fe Mon Sep 17 00:00:00 2001
From: Ian Lance Taylor <ian@gcc.gnu.org>
Date: Fri, 10 Feb 2012 15:55:37 +0000
Subject: [PATCH] runtime: For g0 set stack_size to 0 when not -fsplit-stack.

From-SVN: r184099
---
 libgo/runtime/proc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libgo/runtime/proc.c b/libgo/runtime/proc.c
index 42a5779bc992..94c2a51730e9 100644
--- a/libgo/runtime/proc.c
+++ b/libgo/runtime/proc.c
@@ -909,7 +909,9 @@ runtime_mstart(void* mp)
 	__splitstack_getcontext(&g->stack_context[0]);
 #else
 	g->gcinitial_sp = &mp;
-	g->gcstack_size = StackMin;
+	// Setting gcstack_size to 0 is a marker meaning that gcinitial_sp
+	// is the top of the stack, not the bottom.
+	g->gcstack_size = 0;
 	g->gcnext_sp = &mp;
 #endif
 	getcontext(&g->context);
@@ -1267,6 +1269,8 @@ __go_go(void (*fn)(void*), void* arg)
 #else
 		sp = newg->gcinitial_sp;
 		spsize = newg->gcstack_size;
+		if(spsize == 0)
+			runtime_throw("bad spsize in __go_go");
 		newg->gcnext_sp = sp;
 #endif
 	} else {
-- 
GitLab