]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/gc: don't emit type instructions for nonexisting locals
authorDaniel Morsing <daniel.morsing@gmail.com>
Wed, 27 Feb 2013 18:47:14 +0000 (19:47 +0100)
committerDaniel Morsing <daniel.morsing@gmail.com>
Wed, 27 Feb 2013 18:47:14 +0000 (19:47 +0100)
If all locals are optimized away, the type instructions would stay in the instruction stream. Call fixautoused to scrub the output.

Fixes #4915.

R=rsc
CC=golang-dev
https://golang.org/cl/7385055

src/cmd/gc/pgen.c

index 6f732b991ebcc4eb087211849323372ea5536ab5..df8903bafeaebc737946e3dba82f46e42e960b13 100644 (file)
@@ -209,8 +209,10 @@ allocauto(Prog* ptxt)
        ll = curfn->dcl;
        n = ll->n;
        if (n->class == PAUTO && n->op == ONAME && !n->used) {
+               // No locals used at all
                curfn->dcl = nil;
                stksize = 0;
+               fixautoused(ptxt);
                return;
        }