Fix more nocode_wanted jump problems
In statement expression we really mustn't emit backward jumps under nocode_wanted (they will form infinte loops as no expressions are evaluated). Do-while and explicit loop with gotos weren't handled.
This commit is contained in:
@ -27,6 +27,36 @@ static void kb_wait_2(void)
|
||||
timeout--;
|
||||
} while (timeout);
|
||||
}
|
||||
static void kb_wait_2_1(void)
|
||||
{
|
||||
unsigned long timeout = 2;
|
||||
do {
|
||||
(1 ?
|
||||
printf("timeout=%ld\n", timeout) :
|
||||
({
|
||||
do {
|
||||
printf("error\n");
|
||||
} while (1);
|
||||
})
|
||||
);
|
||||
timeout--;
|
||||
} while (timeout);
|
||||
}
|
||||
static void kb_wait_2_2(void)
|
||||
{
|
||||
unsigned long timeout = 2;
|
||||
do {
|
||||
(1 ?
|
||||
printf("timeout=%ld\n", timeout) :
|
||||
({
|
||||
label:
|
||||
printf("error\n");
|
||||
goto label;
|
||||
})
|
||||
);
|
||||
timeout--;
|
||||
} while (timeout);
|
||||
}
|
||||
static void kb_wait_3(void)
|
||||
{
|
||||
unsigned long timeout = 2;
|
||||
@ -73,6 +103,8 @@ int main()
|
||||
printf("begin\n");
|
||||
kb_wait_1();
|
||||
kb_wait_2();
|
||||
kb_wait_2_1();
|
||||
kb_wait_2_2();
|
||||
kb_wait_3();
|
||||
kb_wait_4();
|
||||
printf("end\n");
|
||||
|
||||
@ -7,4 +7,8 @@ timeout=2
|
||||
timeout=1
|
||||
timeout=2
|
||||
timeout=1
|
||||
timeout=2
|
||||
timeout=1
|
||||
timeout=2
|
||||
timeout=1
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user