Commit 7491bedf authored by Christoph Mallon's avatar Christoph Mallon
Browse files

Fix emission of string initializers.

Non-printable characters are emitted as octal sequences, e.g. \0 for 0.
Always pad them to three digits, so they do not accidently join with a following ASCII digit.
E.g. "\0""7" was emitted as "\07", correct is "\0007".
parent 459319a7
......@@ -884,7 +884,7 @@ static void emit_string_cst(const ir_entity *ent)
if (isprint(c))
be_emit_char(c);
else
be_emit_irprintf("\\%o", c);
be_emit_irprintf("\\%03o", c);
break;
}
}
......@@ -929,7 +929,7 @@ static size_t emit_string_initializer(const ir_initializer_t *initializer)
if (isprint(c))
be_emit_char(c);
else
be_emit_irprintf("\\%o", c);
be_emit_irprintf("\\%03o", c);
break;
}
}
......
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