From: Andreas Schwab Date: Tue, 20 Apr 2021 15:30:46 +0000 (+0200) Subject: Fix endian bug in rust demangler X-Git-Tag: basepoints/gcc-13~8285 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=53bc2e123cd44dc26ae3d2c42b85ee2463f2a7c6;p=thirdparty%2Fgcc.git Fix endian bug in rust demangler libiberty/ PR demangler/100177 * rust-demangle.c (demangle_const_char): Properly print the character value. --- diff --git a/libiberty/rust-demangle.c b/libiberty/rust-demangle.c index 6fd8f6a4db05..449941b56dc1 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{");