From 2795282b50272b0f4d65513658bda5539d07b8a1 Mon Sep 17 00:00:00 2001 From: Ken Thompson Date: Mon, 28 Jun 2010 16:30:55 -0700 Subject: [PATCH] compiler fatal error in switch. fixes #867. R=rsc CC=golang-dev https://golang.org/cl/1691045 --- src/cmd/gc/swt.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/cmd/gc/swt.c b/src/cmd/gc/swt.c index 2ed8216bc0..fbc9c49030 100644 --- a/src/cmd/gc/swt.c +++ b/src/cmd/gc/swt.c @@ -777,11 +777,12 @@ typeswitch(Node *sw) // binary search among cases to narrow by hash cas = list(cas, typebsw(c1, ncase)); } - - cas = list(cas, def); - sw->nbody = concat(cas, sw->nbody); - sw->list = nil; - walkstmtlist(sw->nbody); + if(nerrors == 0) { + cas = list(cas, def); + sw->nbody = concat(cas, sw->nbody); + sw->list = nil; + walkstmtlist(sw->nbody); + } } void