03-08-2018, 12:02 PM
I am not sure, if this potential problem is categorized under any MISRA rules??
The variable var2 can have some value updated outside this function(may be more than 256) and causing a system crash as the while condition never fails.
I run this with PC-Lint and Parasoft's MISRA checker, both doesn't find any error with this portion of code.
Code:
#include
static unsigned short var2;
int main()
{
unsigned char var1 = 0;
while (var1 < var2)
{
var1++;
}
(void)printf("program completed \n ");
return 0;
}
The variable var2 can have some value updated outside this function(may be more than 256) and causing a system crash as the while condition never fails.
I run this with PC-Lint and Parasoft's MISRA checker, both doesn't find any error with this portion of code.
<t></t>