Commit 289d4639 authored by Rob Pike's avatar Rob Pike

cmd/8g: don't crash if Prog->u.branch is nil

The code is copied from cmd/6g.
Empirically, all branch targets are nil in this code so
something is still wrong, but at least this stops 8g -S
from crashing.

Update #7178

LGTM=dave, iant
R=iant, dave
CC=golang-codereviews
https://golang.org/cl/58400043
parent 327e4310
......@@ -107,7 +107,10 @@ Dconv(Fmt *fp)
break;
case D_BRANCH:
snprint(str, sizeof(str), "%d", a->u.branch->loc);
if(a->u.branch == nil)
snprint(str, sizeof(str), "<nil>");
else
snprint(str, sizeof(str), "%d", a->u.branch->loc);
break;
case D_EXTERN:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment