[libcxx-commits] [libcxxabi] 842e48b - [demangler][RISCV] Fix for long double

Piggy NL via libcxx-commits libcxx-commits at lists.llvm.org
Thu May 26 22:53:41 PDT 2022


Author: Piggy NL
Date: 2022-05-27T13:53:20+08:00
New Revision: 842e48bd65770f0368ee0d1ca7ee34dbd8f0ff03

URL: https://github.com/llvm/llvm-project/commit/842e48bd65770f0368ee0d1ca7ee34dbd8f0ff03
DIFF: https://github.com/llvm/llvm-project/commit/842e48bd65770f0368ee0d1ca7ee34dbd8f0ff03.diff

LOG: [demangler][RISCV] Fix for long double

Summary:
The size of long double in RISCV (both RV32 and RV64) is 16 bytes, thus
the mangled_size shouble be 32.

This patch will fix test case
"_ZN5test01hIfEEvRAcvjplstT_Le4001a000000000000000E_c"
in test_demangle.pass.cpp, which is expected to be invalid but demangler
returned "void test0::h<float>(char (&) [(unsigned int)((sizeof (float))
+ (0x0.000000004001ap-16382L))])" in RISCV environment without this patch.

Reviewed By: urnathan

Differential Revision: https://reviews.llvm.org/D126480

Added: 
    

Modified: 
    libcxxabi/src/demangle/ItaniumDemangle.h
    llvm/include/llvm/Demangle/ItaniumDemangle.h

Removed: 
    


################################################################################
diff  --git a/libcxxabi/src/demangle/ItaniumDemangle.h b/libcxxabi/src/demangle/ItaniumDemangle.h
index beece93b21d41..e3f0c6dfecdc2 100644
--- a/libcxxabi/src/demangle/ItaniumDemangle.h
+++ b/libcxxabi/src/demangle/ItaniumDemangle.h
@@ -5099,7 +5099,7 @@ template <>
 struct FloatData<long double>
 {
 #if defined(__mips__) && defined(__mips_n64) || defined(__aarch64__) || \
-    defined(__wasm__)
+    defined(__wasm__) || defined(__riscv)
     static const size_t mangled_size = 32;
 #elif defined(__arm__) || defined(__mips__) || defined(__hexagon__)
     static const size_t mangled_size = 16;

diff  --git a/llvm/include/llvm/Demangle/ItaniumDemangle.h b/llvm/include/llvm/Demangle/ItaniumDemangle.h
index 10210b950d2f9..959632f13e1e2 100644
--- a/llvm/include/llvm/Demangle/ItaniumDemangle.h
+++ b/llvm/include/llvm/Demangle/ItaniumDemangle.h
@@ -5099,7 +5099,7 @@ template <>
 struct FloatData<long double>
 {
 #if defined(__mips__) && defined(__mips_n64) || defined(__aarch64__) || \
-    defined(__wasm__)
+    defined(__wasm__) || defined(__riscv)
     static const size_t mangled_size = 32;
 #elif defined(__arm__) || defined(__mips__) || defined(__hexagon__)
     static const size_t mangled_size = 16;


        


More information about the libcxx-commits mailing list