Fix $8000_0000 % -1 to warn with -Wdiv like $8000_0000 / -1 does (#2012)

This commit is contained in:
Rangi
2026-07-06 15:08:44 -04:00
committed by GitHub
parent be3fc61859
commit 46a6966b70
6 changed files with 25 additions and 12 deletions
+4
View File
@@ -2,6 +2,10 @@ warning: Division of -2147483648 by -1 yields -2147483648 [-Wdiv]
at overflow.asm(23)
warning: Division of -2147483648 by -1 yields -2147483648 [-Wdiv]
at overflow.asm(24)
warning: Modulo of -2147483648 by -1 yields 0 [-Wdiv]
at overflow.asm(28)
warning: Modulo of -2147483648 by -1 yields 0 [-Wdiv]
at overflow.asm(29)
warning: Integer constant is too large [-Wlarge-constant]
at overflow.asm(44)
warning: Graphics constant has too many digits; only first 8 pixels considered [-Wlarge-constant]
+1
View File
@@ -2,6 +2,7 @@ def fzero equs "startof(\"test\")"
section "test", rom0
ld a, $8000_0000 / ({fzero} - 1)
ld a, $8000_0000 / ({fzero} - 2)
ld a, $8000_0000 % ({fzero} - 1)
ld a, 1 << ({fzero} - 1)
ld a, 1 << ({fzero} + 32)
ld a, ({fzero} - 1) >> 1
+8 -6
View File
@@ -1,16 +1,18 @@
warning: Shifting right by large amount 32 [-Wshift-amount]
at patch-diagnostics.asm(12)
warning: Shifting right by negative amount -1 [-Wshift-amount]
at patch-diagnostics.asm(11)
warning: Shifting right by negative amount -1 [-Wshift-amount]
at patch-diagnostics.asm(10)
warning: Shifting right by large amount 32 [-Wshift-amount]
at patch-diagnostics.asm(9)
at patch-diagnostics.asm(10)
warning: Shifting right by negative amount -1 [-Wshift-amount]
at patch-diagnostics.asm(8)
at patch-diagnostics.asm(9)
warning: Shifting right negative value -1 [-Wshift]
at patch-diagnostics.asm(7)
at patch-diagnostics.asm(8)
warning: Shifting left by large amount 32 [-Wshift-amount]
at patch-diagnostics.asm(6)
at patch-diagnostics.asm(7)
warning: Shifting left by negative amount -1 [-Wshift-amount]
at patch-diagnostics.asm(6)
warning: Modulo of -2147483648 by -1 yields 0 [-Wdiv]
at patch-diagnostics.asm(5)
warning: Value $40000000 is not 8-bit [-Wtruncation]
at patch-diagnostics.asm(4)