summaryrefslogtreecommitdiff
path: root/libiberty
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@linux-m68k.org>2021-04-20 17:30:46 +0200
committerAndreas Schwab <schwab@linux-m68k.org>2021-04-21 13:28:21 +0200
commit53bc2e123cd44dc26ae3d2c42b85ee2463f2a7c6 (patch)
tree6635c4625b2aabbc47cc57efb7939e8624fd7051 /libiberty
parent9b6360b83cf5c684422c42301faee3a79ac42dc1 (diff)
Fix endian bug in rust demangler
libiberty/ PR demangler/100177 * rust-demangle.c (demangle_const_char): Properly print the character value.
Diffstat (limited to 'libiberty')
-rw-r--r--libiberty/rust-demangle.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/libiberty/rust-demangle.c b/libiberty/rust-demangle.c
index 6fd8f6a4db0..449941b56dc 100644
--- a/libiberty/rust-demangle.c
+++ b/libiberty/rust-demangle.c
@@ -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{");