diff options
author | Quentin Carbonneaux <quentin@c9x.me> | 2022-12-12 16:55:03 +0100 |
---|---|---|
committer | Quentin Carbonneaux <quentin@c9x.me> | 2022-12-12 17:42:08 +0100 |
commit | 2ec355df6adc457303fcf2076b559fefd80ee593 (patch) | |
tree | a137f74f35d1d5765c0beaa038727123af51e32c /mem.c | |
parent | 7ee9970b32a07a62c625c6ae048366ed0c0b0ce4 (diff) | |
download | roux-2ec355df6adc457303fcf2076b559fefd80ee593.tar.gz |
crash loads from uninitialized slots
Diffstat (limited to 'mem.c')
-rw-r--r-- | mem.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/mem.c b/mem.c index dae9b55..fc3269c 100644 --- a/mem.c +++ b/mem.c @@ -304,12 +304,19 @@ coalesce(Fn *fn) for (u=t->use; u<&t->use[t->nuse]; u++) { assert(u->type == UIns); i = u->u.ins; - if (!req(i->to, R)) { + /* make loads crash */ + if (isload(i->op)) + i->arg[0] = CON_Z; + else if (i->op == Oargc) + i->arg[1] = CON_Z; + else if (!req(i->to, R)) { assert(rtype(i->to) == RTmp); vgrow(&stk, ++n); stk[n-1] = i->to.val; - } else + } else { + assert(!isarg(i->op)); *i = (Ins){.op = Onop}; + } } } vfree(stk); |