mirror of
https://github.com/frida/tinycc
synced 2024-11-24 08:39:37 +03:00
fix c99 for-loop init decl scope (thanks: grischka)
see http://lists.nongnu.org/archive/html/tinycc-devel/2011-03/msg00005.html
This commit is contained in:
parent
9ff91d4c6f
commit
0b8aa909a3
2
tccgen.c
2
tccgen.c
@ -4384,6 +4384,7 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym,
|
||||
int e;
|
||||
next();
|
||||
skip('(');
|
||||
s = local_stack;
|
||||
if (tok != ';') {
|
||||
/* c99 for-loop init decl? */
|
||||
if (!decl0(VT_LOCAL, 1)) {
|
||||
@ -4415,6 +4416,7 @@ static void block(int *bsym, int *csym, int *case_sym, int *def_sym,
|
||||
gjmp_addr(c);
|
||||
gsym(a);
|
||||
gsym_addr(b, c);
|
||||
sym_pop(&local_stack, s);
|
||||
} else
|
||||
if (tok == TOK_DO) {
|
||||
next();
|
||||
|
@ -387,9 +387,11 @@ void loop_test()
|
||||
} while (i < 10);
|
||||
printf("\n");
|
||||
|
||||
char count = 123;
|
||||
/* c99 for loop init test */
|
||||
for (size_t count = 1; count < 3; count++)
|
||||
printf("count=%d\n", count);
|
||||
printf("count = %d\n", count);
|
||||
|
||||
/* break/continue tests */
|
||||
i = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user