From d051c17c70c86b3c9bbc0a0761203d97e8c662d0 Mon Sep 17 00:00:00 2001 From: lemon Date: Thu, 16 Oct 2025 17:53:42 +0200 Subject: various little bugs --- regalloc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'regalloc.c') diff --git a/regalloc.c b/regalloc.c index 165b1cb..64dcfac 100644 --- a/regalloc.c +++ b/regalloc.c @@ -82,7 +82,7 @@ fixlive(struct function *fn) struct bitset definedbuf[4] = {0}; struct bitset *defined = definedbuf; - if (BSSIZE(ninstr) >= sizeof(definedbuf)) + if (BSSIZE(ninstr) >= arraylength(definedbuf)) defined = xcalloc(sizeof *defined * BSSIZE(ninstr)); npendingphi = 0; @@ -1010,7 +1010,7 @@ devirt(struct rega *ra, struct block *blk) if (nspill > 0) assert(ins->op != Ocall); /* devirtualize destination */ - alloc = (it = &ra->intervals.temps[temp]) && it->nrange ? &it->alloc : NULL; + alloc = temp < ra->intervals.count && (it = &ra->intervals.temps[temp]) && it->nrange ? &it->alloc : NULL; if (alloc && alloc->t == ASTACK) { int store = Ostore1 + ilog2(cls2siz[insrescls(*ins)]); /* t was spilled, gen store */ -- cgit v1.2.3