1
0
mirror of https://github.com/cc65/cc65.git synced 2024-12-27 00:29:31 +00:00
cc65/test/val/bug1108.c

38 lines
578 B
C
Raw Normal View History

2020-07-20 13:50:11 +00:00
/* bug #1108 - Problem with static locals? */
#include <stdio.h>
#pragma static-locals (on)
unsigned char x = 0;
static unsigned char PrintVar1(void)
2020-07-20 13:50:11 +00:00
{
unsigned char cx = x + 1;
2020-07-20 13:50:11 +00:00
printf("cx:%d x:%d\n", cx, x);
return cx == 0;
}
static unsigned char PrintVar2(void)
2020-07-20 13:50:11 +00:00
{
unsigned char cx = x + 1;
unsigned char cy;
2020-07-20 13:50:11 +00:00
cy = x + 1;
printf("cx:%d cy:%d x:%d\n", cx, cy, x);
return cx != cy;
}
static unsigned char ret = 0;
2020-07-20 13:50:11 +00:00
int main(void)
{
do {
2020-07-20 13:50:11 +00:00
ret |= PrintVar1();
ret |= PrintVar2();
} while (++x < 10);
2020-07-20 13:50:11 +00:00
return ret;
}