Fix an invalid transformation by the optimizer. Introduced by #2811.

This commit is contained in:
Kugel Fuhr
2026-03-05 18:38:34 +01:00
parent 0fca83500b
commit 380c3f810e
2 changed files with 37 additions and 7 deletions

27
test/val/bug2937.c Normal file
View File

@@ -0,0 +1,27 @@
/* Note: This test is rather fragile since it depends on how the compiler
** handles certain sequences and return codes. It checks for exactly one
** optimizer problem introduced in #2937. If it fails in some future version,
** do not hesitate to remove it.
*/
#include <stdio.h>
static unsigned char test(unsigned v)
{
(void)v;
asm("jsr popax");
asm("lda #0");
return __A__;
}
int main(void)
{
if (test(1)) {
printf("Test failed\n");
return 1;
} else {
printf("Test ok\n");
return 0;
}
}