From f84d5dd4753890f32947e67c8a16d8ca22086551 Mon Sep 17 00:00:00 2001 From: Russ Cox Date: Thu, 14 Mar 2013 10:10:12 -0400 Subject: runtime: make panic possible before malloc is ready Otherwise startup problems can be difficult to debug. R=golang-dev, r CC=golang-dev https://golang.org/cl/7522046 --- src/pkg/runtime/mfixalloc.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/pkg/runtime/mfixalloc.c') diff --git a/src/pkg/runtime/mfixalloc.c b/src/pkg/runtime/mfixalloc.c index c916d588fd..c7dab8aea8 100644 --- a/src/pkg/runtime/mfixalloc.c +++ b/src/pkg/runtime/mfixalloc.c @@ -30,6 +30,11 @@ void* runtime·FixAlloc_Alloc(FixAlloc *f) { void *v; + + if(f->size == 0) { + runtime·printf("runtime: use of FixAlloc_Alloc before FixAlloc_Init\n"); + runtime·throw("runtime: internal error"); + } if(f->list) { v = f->list; -- cgit v1.3