diff options
author | Ori Bernstein <ori@eigenstate.org> | 2015-12-13 22:26:00 -0800 |
---|---|---|
committer | Ori Bernstein <ori@eigenstate.org> | 2015-12-13 22:26:00 -0800 |
commit | 5a1d952aa7f08885c8de6afbbfa948c675f79f89 (patch) | |
tree | fd1ee8287965627f8e654600bff812129de6dfc7 | |
parent | c39b0cd430515c79ce14792b6f815cb7dd9f6e90 (diff) | |
download | mc-5a1d952aa7f08885c8de6afbbfa948c675f79f89.tar.gz |
Fix a couple of segfaults.
We should actually use valid values when generating errors.
-rw-r--r-- | mi/match.c | 4 | ||||
-rw-r--r-- | parse/stab.c | 2 |
2 files changed, 5 insertions, 1 deletions
@@ -565,6 +565,10 @@ static int addstruct(Node *pat, Node *val, Dtree *start, Dtree *accept, Node *** tail = NULL; ntail = 0; + if (!memb) { + memb = mkexpr(ty->sdecls[i]->loc, Ogap, NULL); + memb->expr.type = mty; + } for (j = 0; j < nlast; j++) { /* add a _ capture if we don't specify the value */ if (!memb) { diff --git a/parse/stab.c b/parse/stab.c index f1db002..c139e23 100644 --- a/parse/stab.c +++ b/parse/stab.c @@ -318,7 +318,7 @@ void updatetype(Stab *st, Node *n, Type *t) int mergetype(Type *old, Type *new) { if (!new) { - lfatal(new->loc, "double prototyping of %s", tystr(new)); + lfatal(old->loc, "double prototyping of %s", tystr(new)); } else if (old->vis == Visexport && new->vis != Visexport) { if (!old->sub && new->sub) { |