quakeforge/tools/qfcc/test/voidfor.r
Bill Currie 7701393bd4 Append a new sblock for return when necessary.
If the final block ends in a conditional statement, appending return to the
block will hide the conditional statement from the flow analyzer. This may
cause the conditional statement's destination node be become unreachable
according to the analyzer and thus eliminated. The label for the branch
then loses its target sblock and thus the code generator will produce a
zero-distance jump resulting in an infinite loop.

Thus, if the final block ends in a conditional statement (or, for
completeness, a call statement), append a new empty block before adding the
return statement.
2012-12-21 20:11:27 +09:00

17 lines
115 B
R

void bar ()
{
}
void foo ()
{
int i;
for (i = 0; i < 11; i++)
bar ();
}
int main ()
{
foo ();
return 0;
}