mirror of
https://github.com/frida/tinycc
synced 2024-11-24 08:39:37 +03:00
Code suppression fixes
See adjusted testcase, a lone break; in a do while loop was incorrectly disabling the exit test.
This commit is contained in:
parent
8294285d8f
commit
7ad2cf8d68
2
tccgen.c
2
tccgen.c
@ -6088,6 +6088,8 @@ static void block(int *bsym, int *csym, int is_expr)
|
||||
skip(TOK_WHILE);
|
||||
skip('(');
|
||||
gsym(b);
|
||||
if (b)
|
||||
nocode_wanted = saved_nocode_wanted;
|
||||
gexpr();
|
||||
c = gvtst(0, 0);
|
||||
gsym_addr(c, d);
|
||||
|
@ -26,6 +26,36 @@ static void kb_wait_1(void)
|
||||
timeout--;
|
||||
} while (timeout);
|
||||
}
|
||||
|
||||
static int global;
|
||||
|
||||
static void foo(int i)
|
||||
{
|
||||
global+=i;
|
||||
printf ("g=%d\n", global);
|
||||
}
|
||||
|
||||
static int check(void)
|
||||
{
|
||||
printf ("check %d\n", global);
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void dowhile(void)
|
||||
{
|
||||
do {
|
||||
foo(1);
|
||||
if (global == 1) {
|
||||
continue;
|
||||
} else if (global == 2) {
|
||||
continue;
|
||||
}
|
||||
/* The following break shouldn't disable the check() call,
|
||||
as it's reachable by the continues above. */
|
||||
break;
|
||||
} while (check());
|
||||
}
|
||||
|
||||
int main (void)
|
||||
{
|
||||
int i = 1;
|
||||
@ -118,5 +148,8 @@ enterloop3:
|
||||
printf ("error4\n");
|
||||
}
|
||||
}
|
||||
|
||||
dowhile();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -16,3 +16,8 @@ once3
|
||||
twice3
|
||||
caseok
|
||||
caseok2
|
||||
g=1
|
||||
check 1
|
||||
g=2
|
||||
check 2
|
||||
g=3
|
||||
|
Loading…
Reference in New Issue
Block a user