My Prog.c contains a simple switch case as follows:
switch (x)
{
case 1:
p=2;
break;
case 2:
p=3;
break;
case 3:
p=4;
break;
case 4:
p=5;
break;
case 5:
p=6;
break;
default:
break;
}
I compiled this program with
gcc -g -v prog.c
and created objdump with
objdump -S -l a.out>dump_file
For the switch case statement, I have found that one indirect branch has been created (jmp *%eax
).
But if I remove any one of the case statement, no indirect branch is created.
gcc version: 5.4.0
I could not understand why this is happening?