Commit 06746a3e authored by Matthias Braun's avatar Matthias Braun
Browse files

emit .skip if a string initializer is shorter than the entity

[r14011]
parent 74e0f2ae
......@@ -436,7 +436,10 @@ static int ent_is_string_const(ir_entity *ent)
*/
static void dump_string_cst(obstack_t *obst, ir_entity *ent)
{
int i, n;
int i, n;
ir_type *type;
int type_size;
int remaining_space;
obstack_printf(obst, "\t.string \"");
n = get_compound_ent_n_values(ent);
......@@ -463,6 +466,14 @@ static void dump_string_cst(obstack_t *obst, ir_entity *ent)
}
}
obstack_printf(obst, "\"\n");
type = get_entity_type(ent);
type_size = get_type_size_bytes(type);
remaining_space = type_size - n;
assert(remaining_space >= 0);
if(remaining_space > 0) {
obstack_printf(obst, "\t.skip\t%d\n", remaining_space);
}
}
static void dump_array_init(be_gas_decl_env_t *env, obstack_t *obst,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment