History

crash loads from uninitialized slots

Quentin Carbonneaux committed 3 years ago

Commit 2ec355d1 parent 7ee99701 file · +9 −2Browse files

Unified · Split

mem.c+9−2
@@ -304,12 +304,19 @@ coalesce(Fn *fn) · 303 unmodified lines
304304 for (u=t->use; u<&t->use[t->nuse]; u++) {
305305 assert(u->type == UIns);
306306 i = u->u.ins;
307− if (!req(i->to, R)) {
307+ /* make loads crash */
308+ if (isload(i->op))
309+ i->arg[0] = CON_Z;
310+ else if (i->op == Oargc)
311+ i->arg[1] = CON_Z;
312+ else if (!req(i->to, R)) {
308313 assert(rtype(i->to) == RTmp);
309314 vgrow(&stk, ++n);
310315 stk[n-1] = i->to.val;
311− } else
316+ } else {
317+ assert(!isarg(i->op));
312318 *i = (Ins){.op = Onop};
319+ }
313320 }
314321 }
315322 vfree(stk);

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t