mewmew / uc

A compiler for the µC language.
57 stars 5 forks source link

sem: Global variable declarations inserted into scope twice #64

Closed mewmew closed 8 years ago

mewmew commented 8 years ago

Global variable declarations are added twice, thus resulting in incorrect mapping of tentative definitions.

Proof of concept based on revision mewmew/uc@25bc47e.

Got:

u@x1 ~/D/g/s/g/m/u/foo> uclang a.c
Compiling "a.c"
ident.Start() 4
def.Start() 4
Log:irgen.go:435: create global variable int x;
ident.Start() 11
def.Start() 11
Log:irgen.go:435: create global variable int x;

Expected:

u@x1 ~/D/g/s/g/m/u/foo> uclang a.c
Compiling "a.c"
ident.Start() 4
def.Start() 11
Log:irgen.go:431: ignoring tentative global variable definition of x
ident.Start() 11
def.Start() 11
Log:irgen.go:435: create global variable int x;
mewmew commented 8 years ago

Fixed in rev 8208eb1.