Fix C++ UB from negating INT_MIN with macro shift INT_MIN

This commit is contained in:
Rangi
2026-08-22 18:48:36 -04:00
parent 0888600cb7
commit e287ee2724
4 changed files with 11 additions and 1 deletions
+6
View File
@@ -0,0 +1,6 @@
MACRO m
println \1
shift $8000_0000 ; INT32_MIN
println \1
ENDM
m 1, 2, 3
+2
View File
@@ -0,0 +1,2 @@
warning: Cannot shift macro arguments past their beginning [-Wmacro-shift]
at shift-int-min.asm::m(3) <- shift-int-min.asm(6)
+2
View File
@@ -0,0 +1,2 @@
$1
$1