scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 4fe052f8b8b9962366a33088871b73fa141b693a
parent cd2811b5ff5949ed1c8b466225a77d7abc983b85
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sun, 22 Jan 2017 09:45:46 +0100

[cc1] Use ns from dangling symbol in popctx()

We don't know where popctx() is going to be called and we cannot
be sure that the namespace wasn't changed.

Diffstat:
Mcc1/symbol.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/cc1/symbol.c b/cc1/symbol.c @@ -105,7 +105,7 @@ void popctx(void) { Symbol *next, *sym; - int dangling = 0; + int ns, dangling = 0; /* * we have to be careful before popping the current @@ -120,6 +120,7 @@ popctx(void) */ if ((yytoken == IDEN || yytoken == TYPEIDEN) && yylval.sym->ctx == curctx) { + ns = yylval.sym->ns; dangling = 1; } @@ -148,7 +149,7 @@ popctx(void) } if (dangling) { - yylval.sym = lookup(namespace, yytext, ALLOC); + yylval.sym = lookup(ns, yytext, ALLOC); yytoken = yylval.sym->token; } }