Skip to content

LATX, fix: Abort on itemp register exhaustion - #480

Open
yzewei wants to merge 1 commit into
lat-opensource:masterfrom
yzewei:fix-latx-itemp-exhaustion
Open

LATX, fix: Abort on itemp register exhaustion#480
yzewei wants to merge 1 commit into
lat-opensource:masterfrom
yzewei:fix-latx-itemp-exhaustion

Conversation

@yzewei

@yzewei yzewei commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

ra_alloc_itemp_num() returns -1 when all integer temporary registers are in use. Passing that value into the immediate-cache lookup or IR2 operand construction can cause an out-of-bounds access or generate an invalid register operand, making the translator fail later and obscuring the actual cause.

Detect exhaustion at the allocation site, report the current itemp status, and abort explicitly in release builds.

ra_alloc_itemp_num() returns -1 when all integer temporary registers
are in use. Passing that value into the immediate-cache lookup or IR2
operand construction can cause an out-of-bounds access or generate an
invalid register operand, making the translator fail later and
obscuring the actual cause.

Detect exhaustion at the allocation site, report the current itemp
status, and abort explicitly in release builds.

Signed-off-by: Zewei Yang <yangzewei@loongson.cn>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant