[libcxx-commits] [libcxxabi] [libcxxabi] Use __LDBL_MANT_DIG__ for configuring demangling of long doubles (PR #134976)

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Thu Apr 10 23:51:27 PDT 2025


mstorsjo wrote:

> This is failing on the ppc64le-linux buildbot (https://lab.llvm.org/buildbot/#/builders/72/builds/10061):
> 
> ```
> In file included from /home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/llvm-project/libcxxabi/src/cxa_demangle.cpp:17:
> /home/buildbots/llvm-external-buildbots/workers/ppc64le-sanitizer/sanitizer-ppc64le/build/llvm-project/libcxxabi/src/demangle/ItaniumDemangle.h:5753:2: error: Unknown size for __LDBL_MANT_DIG__
>  5753 | #error Unknown size for __LDBL_MANT_DIG__
> ...
> ```

Sorry about that. I see that powerpc has got `__LDBL_MANT_DIG__` 106, contrary to other 128 bit long doubles that have `__LDBL_MANT_DIG__` equal to 113. I guess the correct case for that would be `mangled_size = 32;` here? The old preexisting ifdefs didn't match for powerpc at all (so it got the default fallback case of `mangled_size = 20` which probably isn't right).

Anyway, we need to fix this. Do you suggest a revert, or fix forward like this?
```diff
diff --git a/libcxxabi/src/demangle/ItaniumDemangle.h b/libcxxabi/src/demangle/ItaniumDemangle.h
index b9d17060c04f..eca9ddad66f9 100644
--- a/libcxxabi/src/demangle/ItaniumDemangle.h
+++ b/libcxxabi/src/demangle/ItaniumDemangle.h
@@ -5741,7 +5741,7 @@ struct FloatData<double>
 template <>
 struct FloatData<long double>
 {
-#if __LDBL_MANT_DIG__ == 113
+#if __LDBL_MANT_DIG__ == 113 || __LDBL_MANT_DIG__ == 106
   static const size_t mangled_size = 32;
 #elif __LDBL_MANT_DIG__ == 53 || defined(_MSC_VER)
   // MSVC doesn't define __LDBL_MANT_DIG__, but it has long double equal to
```

https://github.com/llvm/llvm-project/pull/134976


More information about the libcxx-commits mailing list