scc

simple c99 compiler
git clone git://git.simple-cc.org/scc
Log | Files | Refs | Submodules | README | LICENSE

commit 7d9377555e840e495a210b50151c915c269f8dc9
parent bb51af89d1a78297f2f6ef745166a53f42c28ebf
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Mon,  1 Nov 2021 23:25:17 +0100

cc1: Allocate an identifier for local initializers

In the case of local initializers a hidden variable is emitted,
but this variable lacked an identifer. In this case, the default
identifier is 0, that cc2 understand as a temporary value, which
meant that it was not inserted in the hash table. Every access
to the symbol identified by 0 was generating new symbols, without
relation between them.

Diffstat:
Msrc/cmd/cc/cc1/init.c | 1+
1 file changed, 1 insertion(+), 0 deletions(-)

diff --git a/src/cmd/cc/cc1/init.c b/src/cmd/cc/cc1/init.c @@ -327,6 +327,7 @@ repeat: if (!(np->flags & NCONST)) abort(); /* TODO */ hidden = newsym(NS_IDEN, NULL); + hidden->id = newid(); hidden->type = sym->type; hidden->flags |= SLOCAL | SHASINIT; emit(ODECL, hidden);