From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2138) id CC222385800A; Wed, 21 Apr 2021 11:31:45 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CC222385800A MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Andreas Schwab To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-8273] Fix endian bug in rust demangler X-Act-Checkin: gcc X-Git-Author: Andreas Schwab X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: 89ddb58cda7b4a54626170f9491fc2a0f82d85f5 X-Git-Newrev: 4cdb510fb0d4e285b0565f402883025998ba6250 Message-Id: <20210421113145.CC222385800A@sourceware.org> Date: Wed, 21 Apr 2021 11:31:45 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Apr 2021 11:31:45 -0000 https://gcc.gnu.org/g:4cdb510fb0d4e285b0565f402883025998ba6250 commit r11-8273-g4cdb510fb0d4e285b0565f402883025998ba6250 Author: Andreas Schwab Date: Tue Apr 20 17:30:46 2021 +0200 Fix endian bug in rust demangler libiberty/ PR demangler/100177 * rust-demangle.c (demangle_const_char): Properly print the character value. Diff: --- libiberty/rust-demangle.c | 9 ++++++--- 1 file 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{");