public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-8273] Fix endian bug in rust demangler
@ 2021-04-21 11:31 Andreas Schwab
  0 siblings, 0 replies; only message in thread
From: Andreas Schwab @ 2021-04-21 11:31 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:4cdb510fb0d4e285b0565f402883025998ba6250

commit r11-8273-g4cdb510fb0d4e285b0565f402883025998ba6250
Author: Andreas Schwab <schwab@linux-m68k.org>
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{");


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-04-21 11:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-21 11:31 [gcc r11-8273] Fix endian bug in rust demangler Andreas Schwab

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).