Fix endian bug in rust demangler

libiberty/
	PR demangler/100177
	* rust-demangle.c (demangle_const_char): Properly print the
	character value.
This commit is contained in:
Andreas Schwab 2021-04-20 17:30:46 +02:00
parent 9b6360b83c
commit 53bc2e123c

View File

@ -1253,9 +1253,12 @@ demangle_const_char (struct rust_demangler *rdm)
else if (value == '\n')
PRINT ("\\n");
else if (value > ' ' && value < '~')
/* Rust also considers many non-ASCII codepoints to be printable, but
that logic is not easily ported to C. */
print_str (rdm, (char *) &value, 1);
{
/* Rust also considers many non-ASCII codepoints to be printable, but
that logic is not easily ported to C. */
char c = value;
print_str (rdm, &c, 1);
}
else
{
PRINT ("\\u{");