scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit 51cf75b9b31e81acf9570ab07cc59fe95408816f
parent b86fdca96b49c9000d32995a427f2ac8fad4ef6a
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri, 24 Jul 2015 18:55:23 +0200

Don't install tags that are already installed

The code was installing all the tags it found, even in the cases
the tag was already installed, creating wrong symbols without
type.

Diffstat:
cc1/decl.c | 4++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/cc1/decl.c b/cc1/decl.c @@ -303,7 +303,8 @@ newtag(void) case IDEN: case TYPEIDEN: sym = yylval.sym; - install(NS_TAG); + if ((sym->flags & ISDEFINED) == 0) + install(NS_TAG); next(); break; default: @@ -317,7 +318,6 @@ newtag(void) sym->type->ns = ns++; } - sym->flags |= ISDEFINED; if ((op = sym->type->op) != tag && op != INT) error("'%s' defined as wrong kind of tag", sym->name); return sym;