compiler: the most negative int is emitted as itself - itoa took its digits off -v, which overflows back to itself, so 0x80000000 in an int was written as a bare "-" (invalid IR); digits now come off v as it is, and the buffer holds a long's 20

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-29 22:00:49 +03:00
parent 3d5aaa6f6e
commit 37338cb0f7
3 changed files with 27 additions and 4 deletions

View file

@ -0,0 +1,10 @@
# int_min_literal.ludic - a literal that lands on the most negative int (0x80000000 in an int) is
# emitted as -2147483648. It once came out as a bare "-", invalid IR. Prints `-2147483648 -1 1`.
program IntMinLiteral {
entry {
let x = len(Os.args()) - 5
let top = x & 0x80000000
let low = x | 0x7FFFFFFF
print(`{top} {low} {(x & 0x80000000) != 0}`)
}
}