The gas manual says "The same escapes apply to characters as to strings" (http://sourceware.org/binutils/docs-2.20/as/Chars.html#Chars), and one of the string escapes is "\ digit digit digit", "An octal character code." (http://sourceware.org/binutils/docs-2.20/as/Strings.html#Strings). Also, "Any other character when escaped by \ gives a warning, but assembles as if the `\' was not present"
Gas appears to directly replace a character constant with the number, instead of replacing the whole field, so things like 'A0 are legal ('A becomes 65, and it's like you typed 650). I assume this is intended behavior and not a bug, although I can't find it documented anywhere. However, constants like '\000 appear to be handled incorrectly. \0 isn't a valid escape, so it's just handled as a normal 0. '0 becomes 48 (the code for 0), and the other 0s are suffixed as above, so '\000 = '000 = 4800 -- Summary: Odd behavior of character escapes Product: binutils Version: 2.19 Status: NEW Severity: normal Priority: P3 Component: gas AssignedTo: unassigned at sources dot redhat dot com ReportedBy: mmrozek at arxandefense dot com CC: bug-binutils at gnu dot org GCC host triplet: ppc-unknown-linux-gnu GCC target triplet: ppc-unknown-linux-gnu http://sourceware.org/bugzilla/show_bug.cgi?id=10946 ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is. _______________________________________________ bug-binutils mailing list bug-binutils@gnu.org http://lists.gnu.org/mailman/listinfo/bug-binutils