summaryrefslogtreecommitdiff
path: root/parse/stab.c
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2016-02-25 15:28:14 -0800
committerOri Bernstein <ori@eigenstate.org>2016-02-25 15:28:57 -0800
commit2a76c9fc491ab08492491ddce7fb26d953879791 (patch)
tree9171cad950e4e55f5445676a9bf6c56700f6532a /parse/stab.c
parent16bbf82067cacf44828b5f5023bdd6ec3b80b570 (diff)
downloadmc-2a76c9fc491ab08492491ddce7fb26d953879791.tar.gz
Fix forward labels in nested blocks.
Fixes #91
Diffstat (limited to 'parse/stab.c')
-rw-r--r--parse/stab.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/parse/stab.c b/parse/stab.c
index f23b1fd..545d361 100644
--- a/parse/stab.c
+++ b/parse/stab.c
@@ -184,10 +184,7 @@ Node *getdcl(Stab *st, Node *n)
void putlbl(Stab *st, char *name, Node *lbl)
{
- while (st && !st->isfunc)
- st = st->super;
- if (!st)
- fatal(lbl, "label %s defined outside function\n", name);
+ assert(st && st->isfunc);
if (hthas(st->lbl, name))
fatal(lbl, "duplicate label %s, first defined on line %d\n", name, lbl->loc.line);
htput(st->lbl, name, lbl);