From 43c04ba1b8c81114d09c0f9f326987070e0ee291 Mon Sep 17 00:00:00 2001 From: Daniel Morsing Date: Wed, 27 Feb 2013 19:47:14 +0100 Subject: [PATCH] cmd/gc: don't emit type instructions for nonexisting locals 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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/cmd/gc/pgen.c b/src/cmd/gc/pgen.c index 6f732b991eb..df8903bafea 100644 --- a/src/cmd/gc/pgen.c +++ b/src/cmd/gc/pgen.c @@ -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; }