fix 'COMMON' variables in cparser
authorMatthias Braun <matze@braunis.de>
Wed, 3 Feb 2010 20:25:52 +0000 (20:25 +0000)
committerMatthias Braun <matze@braunis.de>
Wed, 3 Feb 2010 20:25:52 +0000 (20:25 +0000)
[r27033]

ast2firm.c

index e699f4a..764ea68 100644 (file)
@@ -4549,6 +4549,9 @@ static void create_global_variable(entity_t *entity)
        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);
 }