[PATCH] D126480: [demangler][RISCV] Fix for long double

Piggy NL via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu May 26 08:29:47 PDT 2022


piggynl created this revision.
piggynl added a reviewer: rsmith.
Herald added subscribers: sunshaoce, VincentWu, luke957, vkmr, evandro, luismarques, sameer.abuasal, s.egerton, Jim, benna, psnobl, PkmX, rogfer01, shiva0217, kito-cheng, simoncook, arichardson.
Herald added a project: All.
piggynl requested review of this revision.
Herald added subscribers: llvm-commits, libcxx-commits, pcwang-thead, eopXD, aheejin.
Herald added projects: libc++abi, LLVM.
Herald added a reviewer: libc++abi.

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

This patch will fix the 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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D126480

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


Index: llvm/include/llvm/Demangle/ItaniumDemangle.h
===================================================================
--- llvm/include/llvm/Demangle/ItaniumDemangle.h
+++ llvm/include/llvm/Demangle/ItaniumDemangle.h
@@ -5099,7 +5099,7 @@
 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;
Index: libcxxabi/src/demangle/ItaniumDemangle.h
===================================================================
--- libcxxabi/src/demangle/ItaniumDemangle.h
+++ libcxxabi/src/demangle/ItaniumDemangle.h
@@ -5099,7 +5099,7 @@
 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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D126480.432294.patch
Type: text/x-patch
Size: 1132 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220526/5d1d8c78/attachment.bin>


More information about the llvm-commits mailing list