Minimal test for issue #2946

This commit is contained in:
Alex Volkov
2026-03-20 19:51:37 -04:00
parent 2fd9411f7f
commit f464b50495

22
test/val/bug2946.c Normal file
View File

@@ -0,0 +1,22 @@
/* bug #2946: Incomplete, non-removable Rhs asserts in OptStackOps */
#include <stdio.h>
#include <stdlib.h>
unsigned char a, b = 0;
unsigned char c = 10;
unsigned char d = 1;
int main(void) {
/* 'if' needed to produce a label below, moved by OptJumpTarget3 */
if (b != 0) {
/* Operation not important; it only affects the removal of one LDX #$00 */
b = 0;
}
/* d >= 0 is const, A/X=1 (Warning: Result of comparison is always true) */
a = c - (d >= 0);
return !(a == 9);
}