mirror of
https://github.com/cc65/cc65.git
synced 2025-01-14 16:33:00 +00:00
testcase for issue #263
This commit is contained in:
parent
b08dc28cc1
commit
0db23a8951
49
test/val/bug263.c
Normal file
49
test/val/bug263.c
Normal file
@ -0,0 +1,49 @@
|
||||
|
||||
/* issue #263 - cc65 miscompiles w/ a static variable and -O */
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
int failures = 0;
|
||||
|
||||
void __fastcall__ set_vram_update(unsigned char *ptr)
|
||||
{
|
||||
printf("set_vram_update: %04x\n", ptr);
|
||||
if (ptr != NULL) {
|
||||
failures++;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned char __fastcall__ ppu_wait_nmi(void)
|
||||
{
|
||||
// we need to make sure somehow the akku is not zero before the break
|
||||
return 0x1234;
|
||||
}
|
||||
|
||||
unsigned char ctrl, ret, i;
|
||||
|
||||
unsigned char gameloop (void)
|
||||
{
|
||||
ctrl = 0;
|
||||
ret = 0;
|
||||
while(1) {
|
||||
if (ctrl & 1) {
|
||||
while (--i) {
|
||||
ppu_wait_nmi();
|
||||
}
|
||||
break;
|
||||
}
|
||||
ctrl = 1;
|
||||
}
|
||||
// This will pass garbage, not NULL.
|
||||
set_vram_update(NULL);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
gameloop();
|
||||
printf("failures: %d\n", failures);
|
||||
return failures;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user