diff options
| author | 2023-06-19 22:35:22 +0200 | |
|---|---|---|
| committer | 2023-06-19 22:35:22 +0200 | |
| commit | 6fa5dbadce1f54d96e44c195167016278621ace1 (patch) | |
| tree | b321fbd1eb79bb719811f86b2d20c5b56bf188dd | |
| parent | 61367525aea8f3f11c29e628fe49768dda959cef (diff) | |
regalloc: alloc extra memory for alloc map
regalloc itself can insert instructions so this was causing
out of bounds read errors
| -rw-r--r-- | regalloc.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -257,7 +257,7 @@ regalloc(struct function *fn) struct rega ra = {0}; vinit(&stkslotrefs, stkslotrefsbuf, arraylength(stkslotrefsbuf)); - ra.allocs = xcalloc(ninstr * sizeof(struct alloc)); + ra.allocs = xcalloc((ninstr*2 < MAXINSTR ? ninstr*2 : MAXINSTR) * sizeof(struct alloc)); ra.nfreegpr = mctarg->ngpr - popcnt(mctarg->rglob->u); ra.nfreefpr = mctarg->nfpr; for (int i = 0; i < MAXREGS; ++i) |