mirror of
https://github.com/mirror/tinycc.git
synced 2025-03-30 12:20:06 +08: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(TOK_WHILE);
|
||||||
skip('(');
|
skip('(');
|
||||||
gsym(b);
|
gsym(b);
|
||||||
|
if (b)
|
||||||
|
nocode_wanted = saved_nocode_wanted;
|
||||||
gexpr();
|
gexpr();
|
||||||
c = gvtst(0, 0);
|
c = gvtst(0, 0);
|
||||||
gsym_addr(c, d);
|
gsym_addr(c, d);
|
||||||
|
@ -26,6 +26,36 @@ static void kb_wait_1(void)
|
|||||||
timeout--;
|
timeout--;
|
||||||
} while (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 main (void)
|
||||||
{
|
{
|
||||||
int i = 1;
|
int i = 1;
|
||||||
@ -118,5 +148,8 @@ enterloop3:
|
|||||||
printf ("error4\n");
|
printf ("error4\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dowhile();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -16,3 +16,8 @@ once3
|
|||||||
twice3
|
twice3
|
||||||
caseok
|
caseok
|
||||||
caseok2
|
caseok2
|
||||||
|
g=1
|
||||||
|
check 1
|
||||||
|
g=2
|
||||||
|
check 2
|
||||||
|
g=3
|
||||||
|
Loading…
Reference in New Issue
Block a user