bug-477927.c

来自「sdcc是为51等小型嵌入式cpu设计的c语言编译器支持数种不同类型的cpu」· C语言 代码 · 共 51 行

C
51
字号
/* Tests an uninitalised variable bug.   t is not initalised in all paths in the do loop, causing the while   conditional to fail unpredictably.   Doesn't actually test, is really an example. */#include <testfwk.h>typedef unsigned char UBYTE;UBYTErandish(void){  static int count;  if ((++count)&3) {    return 1;  }  else {    return 0;  }}voidspoil(UBYTE ignored){  UNUSED(ignored);}UBYTE accu[2];#if !defined(PORT_HOST)#  pragma disable_warning 84#endifvoid testLoopInit(void){  UBYTE t, r;  do {    r = randish();    if(r != 1) {      t = ++accu[r];      spoil(t);    }  }  while(t != 3);}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?