X-Git-Url: http://nsz.repo.hu/git/?a=blobdiff_plain;f=ir%2Fbe%2Fbegnuas.c;h=0679d60927c9b6f31eb5d59fa708e2c41dfd021c;hb=843b76dd943762929f132df611b583fd4701f8e4;hp=370c75726d492354d48f76847aa2bf2e6c31c148;hpb=a57a93ec077dc17b1676004b7d2a26e193da3e5f;p=libfirm diff --git a/ir/be/begnuas.c b/ir/be/begnuas.c index 370c75726..0679d6092 100644 --- a/ir/be/begnuas.c +++ b/ir/be/begnuas.c @@ -24,9 +24,7 @@ * @date 04.11.2005 * @version $Id$ */ -#ifdef HAVE_CONFIG_H #include "config.h" -#endif #include "begnuas.h" @@ -634,19 +632,21 @@ static int ent_is_string_const(ir_entity *ent) static void dump_string_cst(ir_entity *ent) { int i, len; + int output_len; ir_type *type; int type_size; int remaining_space; - len = get_compound_ent_n_values(ent); + len = get_compound_ent_n_values(ent); + output_len = len; if (be_gas_flavour == GAS_FLAVOUR_MACH_O) { be_emit_cstring("\t.ascii \""); } else { be_emit_cstring("\t.string \""); - len -= 1; + output_len -= 1; } - for (i = 0; i < len; ++i) { + for (i = 0; i < output_len; ++i) { ir_node *irn; int c; @@ -814,6 +814,7 @@ static void dump_bitfield(normal_or_bitfield *vals, size_t offset_bits, if (tv == NULL) { panic("Couldn't get numeric value for bitfield initializer"); } + tv = tarval_convert_to(tv, get_type_mode(type)); /* normalize offset */ vals += offset_bits >> 3; @@ -951,7 +952,7 @@ static void dump_initializer(be_gas_decl_env_t *env, ir_entity *entity) * In the worst case, every initializer allocates one byte. * Moreover, initializer might be big, do not allocate on stack. */ - vals = xcalloc(size, sizeof(vals[0])); + vals = XMALLOCNZ(normal_or_bitfield, size); #ifndef NDEBUG glob_vals = vals; @@ -1040,7 +1041,7 @@ static void dump_compound_init(be_gas_decl_env_t *env, ir_entity *ent) * In the worst case, every initializer allocates one byte. * Moreover, initializer might be big, do not allocate on stack. */ - vals = xcalloc(last_ofs, sizeof(vals[0])); + vals = XMALLOCNZ(normal_or_bitfield, last_ofs); /* collect the values and store them at the offsets */ for (i = 0; i < n; ++i) {