I am working on arm xscale embedded system. Here I am seeing a incorrect branch is getting executed in switch case.
Below is my switch case looks like,
switch(val)
{
case 0:
....
break;
case 1:
....
break;
case 2:
.....
break;
case 3:
.....
break;
default:
printf("case value = %d\r\n" ,val);
break;
}
In the above case , I am receiving value as zero i.e val = 0.
But the cpu branches to default case, where i have printed the value, which is showing zero only. "case value = 0". Looks very strange.
Break statements are proper. "val" is a signed int(no problem there).
I have tried to understand the assembly generated for this switch case block, but I don't understand the logic used in the generated assembly instructions.
I don't think wrong assembly was generated by assembler(may be I don't know).Is there any possiblity of hardware bug which will create this kind of problem like issues in MMU or TLB , instruction cache parity issues or any other thing ?How to debug this issue?