commit 1ad229b4a8dc58eddc4b4880dd470e093d6d4433
parent b8d8981da6ab2fd80153db23d30ca36c6d8250fb
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:
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);