summaryrefslogtreecommitdiff
path: root/src/cmd/8g
diff options
context:
space:
mode:
authorRob Pike <r@golang.org>2014-01-29 16:14:45 -0800
committerRob Pike <r@golang.org>2014-01-29 16:14:45 -0800
commitd7bd1eb1d534c878e9e0e2202d40fa8b66a69423 (patch)
treec4e47dd87037e199fcea281c378f9639adf9ad75 /src/cmd/8g
parent7058930cbc7c2a4e1377e37c7573dcd8c41a96e5 (diff)
downloadgo-d7bd1eb1d534c878e9e0e2202d40fa8b66a69423.tar.gz
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 issue 7178 LGTM=dave, iant R=iant, dave CC=golang-codereviews https://codereview.appspot.com/58400043
Diffstat (limited to 'src/cmd/8g')
-rw-r--r--src/cmd/8g/list.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/cmd/8g/list.c b/src/cmd/8g/list.c
index 96954d4bb..558d9c690 100644
--- a/src/cmd/8g/list.c
+++ b/src/cmd/8g/list.c
@@ -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: