]> Cypherpunks repositories - gostls13.git/commitdiff
avoid seg fault when return type is unknown
authorRuss Cox <rsc@golang.org>
Thu, 12 Nov 2009 06:20:05 +0000 (22:20 -0800)
committerRuss Cox <rsc@golang.org>
Thu, 12 Nov 2009 06:20:05 +0000 (22:20 -0800)
Fixes #80.

R=ken
https://golang.org/cl/154079

src/cmd/gc/subr.c

index 35a3a2f95145fbc0e3bddd25aaed650e31466890..75ece477d26e0ef25b3fe610ee5fcad0354038bb 100644 (file)
@@ -1138,6 +1138,11 @@ Tpretty(Fmt *fp, Type *t)
                        break;
                case 1:
                        t1 = getoutargx(t)->type;
+                       if(t1 == T) {
+                               // failure to typecheck earlier; don't know the type
+                               fmtprint(fp, " ?unknown-type?");
+                               break;
+                       }
                        if(t1->etype != TFIELD && t1->etype != TFUNC) {
                                fmtprint(fp, " %T", t1);
                                break;