aboutsummaryrefslogtreecommitdiffhomepage
path: root/regalloc.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-10-16 17:53:42 +0200
committerlemon <lsof@mailbox.org>2025-10-16 17:53:42 +0200
commitd051c17c70c86b3c9bbc0a0761203d97e8c662d0 (patch)
tree0a4b1e27b5a7ef3092a476952727def0900d496a /regalloc.c
parent77b13b42643991fc8c2b8942ca167eb7bf156908 (diff)
various little bugs
Diffstat (limited to 'regalloc.c')
-rw-r--r--regalloc.c4
1 files changed, 2 insertions, 2 deletions
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 */