1 /* This checks various ways of dead code inside if statements
2 where there are non-obvious ways of how the code is actually
3 not dead due to reachable by labels. */
4 extern int printf (const char *, ...);
5 static void kb_wait_1(void)
7 unsigned long timeout
= 2;
9 /* Here the else arm is a statement expression that's supposed
10 to be suppressed. The label inside the while would unsuppress
11 code generation again if not handled correctly. And that
12 would wreak havok to the cond-expression because there's no
13 jump-around emitted, the whole statement expression really
14 needs to not generate code (perhaps except useless forward jumps). */
16 printf("timeout=%ld\n", timeout
) :
34 /* Simple test of dead code at first sight which isn't actually dead. */
44 /* Some more non-obvious uses where the problems are loops, so that even
45 the first loop statements aren't actually dead. */
57 /* The same with statement expressions. One might be tempted to
58 handle them specially by counting if inside statement exprs and
59 not unsuppressing code at loops at all then.
60 See kb_wait_1 for the other side of the medal where that wouldn't work. */
74 /* The other two loop forms: */
97 /* And check that case and default labels have the same effect
98 of disabling code suppression. */
115 printf ("caseok2\n");