This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: How are case statements laid out?
On Tue, Dec 04, 2001 at 10:11:22AM -0500, Peter Barada wrote:
> Do you have an example?
Well, the easiest example is
gcc -O2 -S -fno-reorder-blocks z.c
int foo(int i)
{
if (i < 0)
{
label:
return -1;
}
switch (i)
{
case 0:
return 0;
case 1:
return 1;
case 2:
return 2;
case 3:
return 3;
case 4:
return 4;
case 5:
goto label;
}
return 6;
}
as the goto will be folded into the table jump directly.
But apart from that -freorder-blocks will rearrange everything
as it sees fit.
r~