📄 bug-895992.c
字号:
/* bug-895992.c Life Range problem with - uninitialized variable - loop - conditional block LR problem hits all ports, but this test is mcs51 specific */#include <testfwk.h>char p0 = 2;unsigned short loops;static voidwait (void){ long i, j; /* just clobber all registers: */ for (i = 0; i < 2; ++i) for (j = 0; j < 2; ++j) ;}#if !defined(PORT_HOST)# pragma disable_warning 84#endifstatic voidtestLR(void){/* * excluded for pic16 due to bug: * [ 1511794 ] pic16: regression test bug-895992.c fails */#ifndef SDCC_pic16 unsigned char number; unsigned char start = 1; unsigned char i; do { for (i = 1; i > 0 ; i--) wait(); /* destroys all registers */ if (start) { number = p0; start = 0; } number--; /* 'number' might be used before initialization */ /* the life range of 'number' must be extended to */ /* the whole loop _including_ the conditional block */ ++loops; } while (number != 0); ASSERT(loops == p0);#endif}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -