]> Cypherpunks repositories - gostls13.git/commitdiff
bug 158
authorKen Thompson <ken@golang.org>
Sun, 31 May 2009 00:06:51 +0000 (17:06 -0700)
committerKen Thompson <ken@golang.org>
Sun, 31 May 2009 00:06:51 +0000 (17:06 -0700)
R=r
OCL=29646
CL=29646

src/cmd/gc/swt.c
test/bugs/bug157.go
test/fixedbugs/bug158.go [moved from test/bugs/bug158.go with 86% similarity]
test/golden.out

index 3f62706f70e3ec047afe865a8aaa27060be38a74..31842763659bedb7abc9b97c858564e92bdd02f7 100644 (file)
@@ -33,6 +33,14 @@ struct       Case
 };
 #define        C       ((Case*)nil)
 
+Type*
+notideal(Type *t)
+{
+       if(t != T && t->etype == TIDEAL)
+               return T;
+       return t;
+}
+
 void
 dumpcase(Case *c0)
 {
@@ -254,8 +262,8 @@ sw0(Node *c, Type *place, int arg)
 Type*
 sw1(Node *c, Type *place, int arg)
 {
-       if(place == T)
-               return c->type;
+       if(place != T)
+               return notideal(c->type);
        return place;
 }
 
@@ -605,7 +613,7 @@ exprswitch(Node *sw)
         * walk the cases as appropriate for switch type
         */
        walkcases(sw, sw0, arg);
-       t = sw->ntest->type;
+       t = notideal(sw->ntest->type);
        if(t == T)
                t = walkcases(sw, sw1, arg);
        if(t == T)
index 207f6bcfdb31cc0b19492c52fbf2af0eff3f5969..9bf68f7a475a629236d947b7ad02a786b698ad9c 100644 (file)
@@ -27,6 +27,6 @@ func main() {
 
 
 /*
-bug155.go:20: syntax error near default
-bug155.go:20: first switch statement must be a case
+bug157.go:20: syntax error near default
+bug157.go:20: first switch statement must be a case
 */
similarity index 86%
rename from test/bugs/bug158.go
rename to test/fixedbugs/bug158.go
index a40bf823a0d400f05dfda900c41771b2b72c57f6..cdf3195feb3bcaa8022a401e8b846e9d4a858fd6 100644 (file)
@@ -22,5 +22,5 @@ func main() {
 
 
 /*
-bug156.go:14: fatal error: dowidth: unknown type: E-33
+bug158.go:14: fatal error: dowidth: unknown type: E-33
 */
index 13c83aa80d3a56fd3d881000fe476857fda9cbdf..4e7f81552e272a4846b4bf86db3cecfa221f3e44 100644 (file)
@@ -109,10 +109,6 @@ bugs/bug157.go:20: syntax error near default
 bugs/bug157.go:20: first switch statement must be a case
 BUG: should compile
 
-=========== bugs/bug158.go
-bugs/bug158.go:14: fatal error: dowidth: unknown type: E-33
-BUG: should compile
-
 =========== fixedbugs/bug016.go
 fixedbugs/bug016.go:7: constant -3 overflows uint