Fix creation of uninitialized global variables.

This commit is contained in:
Bill Currie 2011-02-06 14:37:25 +09:00
parent 59d3dc6ae0
commit 00bba1eb3a

View file

@ -354,13 +354,17 @@ external_decl
: var_decl
{
specifier_t spec = $<spec>0;
type_t *type;
$1->type = find_type (append_type ($1->type, $<spec>0.type));
type = find_type (append_type ($1->type, spec.type));
if (spec.is_typedef) {
$1->type = type;
$1->sy_type = sy_type;
symtab_addsymbol (current_symtab, $1);
} else {
initialize_def ($1, type, 0, current_symtab->space,
spec.storage);
}
symtab_addsymbol (current_symtab, $1);
}
| var_decl '=' var_initializer
| function_decl