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;
|
|
|
|
|
2020-07-20 21:16:11 +00:00
|
|
|
static unsigned char PrintVar1(void)
|
2020-07-20 13:50:11 +00:00
|
|
|
{
|
|
|
|
unsigned char cx = x + 1;
|
2020-07-20 21:16:11 +00:00
|
|
|
|
2020-07-20 13:50:11 +00:00
|
|
|
printf("cx:%d x:%d\n", cx, x);
|
|
|
|
return cx == 0;
|
|
|
|
}
|
|
|
|
|
2020-07-20 21:16:11 +00:00
|
|
|
static unsigned char PrintVar2(void)
|
2020-07-20 13:50:11 +00:00
|
|
|
{
|
|
|
|
unsigned char cx = x + 1;
|
|
|
|
unsigned char cy;
|
2020-07-20 21:16:11 +00:00
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2020-07-20 21:16:11 +00:00
|
|
|
static unsigned char ret = 0;
|
2020-07-20 13:50:11 +00:00
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
2020-07-20 21:16:11 +00:00
|
|
|
do {
|
2020-07-20 13:50:11 +00:00
|
|
|
ret |= PrintVar1();
|
|
|
|
ret |= PrintVar2();
|
2020-07-20 21:16:11 +00:00
|
|
|
} while (++x < 10);
|
2020-07-20 13:50:11 +00:00
|
|
|
return ret;
|
|
|
|
}
|