From: Christoph Mallon Date: Wed, 17 Aug 2011 13:44:43 +0000 (+0200) Subject: Fix emission of string initializers. X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=7491bedf6b9fb310379481c7cd10521d60ea6c46;p=libfirm 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". --- diff --git a/ir/be/begnuas.c b/ir/be/begnuas.c index 72b46aa3e..1fc3f31af 100644 --- a/ir/be/begnuas.c +++ b/ir/be/begnuas.c @@ -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; } }