From: Matthias Braun Date: Wed, 3 Feb 2010 20:30:12 +0000 (+0000) Subject: further corrections on 'COMMON' semantic X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=b56be3f223dae82c5986bac5753e16aab16e7706;p=cparser further corrections on 'COMMON' semantic [r27034] --- diff --git a/ast2firm.c b/ast2firm.c index 764ea68..7e99d62 100644 --- a/ast2firm.c +++ b/ast2firm.c @@ -4540,18 +4540,20 @@ static void create_global_variable(entity_t *entity) switch ((storage_class_tag_t)entity->declaration.storage_class) { case STORAGE_CLASS_STATIC: linkage |= IR_LINKAGE_LOCAL; break; case STORAGE_CLASS_EXTERN: linkage |= IR_LINKAGE_EXTERN; break; + case STORAGE_CLASS_NONE: + /* uninitialized globals get merged in C */ + if (entity->variable.initializer == NULL) + linkage |= IR_LINKAGE_MERGE; + break; case STORAGE_CLASS_TYPEDEF: case STORAGE_CLASS_AUTO: case STORAGE_CLASS_REGISTER: - case STORAGE_CLASS_NONE: break; + break; } ir_type *var_type = entity->variable.thread_local ? get_tls_type() : get_glob_type(); create_variable_entity(entity, DECLARATION_KIND_GLOBAL_VARIABLE, var_type); - /* uninitialized globals get merged in C */ - if (entity->variable.initializer == NULL) - linkage |= IR_LINKAGE_MERGE; add_entity_linkage(entity->variable.v.entity, linkage); }