[all-commits] [llvm/llvm-project] 3b7071: [libcxxabi] Use __LDBL_MANT_DIG__ for configuring ...

Martin Storsjö via All-commits all-commits at lists.llvm.org
Thu Apr 10 22:54:33 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3b70715c13876c51542ebfe2e3f4ee908f6785cb
      https://github.com/llvm/llvm-project/commit/3b70715c13876c51542ebfe2e3f4ee908f6785cb
  Author: Martin Storsjö <martin at martin.st>
  Date:   2025-04-11 (Fri, 11 Apr 2025)

  Changed paths:
    M libcxxabi/src/demangle/ItaniumDemangle.h
    M libcxxabi/test/test_demangle.pass.cpp

  Log Message:
  -----------
  [libcxxabi] Use __LDBL_MANT_DIG__ for configuring demangling of long doubles (#134976)

This avoids needing to hardcode the mapping between architectures and
their sizes of long doubles.

This fixes a case in test_demangle.pass.cpp, that previously failed like
this (XFAILed):

    .---command stdout------------
    | Testing 29859 symbols.
| _ZN5test01hIfEEvRAcvjplstT_Le4001a000000000000000E_c should be invalid
but is not
| Got: 0, void test0::h<float>(char (&) [(unsigned int)(sizeof (float) +
0x0.07ff98f7ep-1022L)])
    `-----------------------------
    .---command stderr------------
| Assertion failed: !passed && "demangle did not fail", file
libcxxabi/test/test_demangle.pass.cpp, line 30338
    `-----------------------------

This testcase is defined within

// Is long double fp80? (Only x87 extended double has 64-bit mantissa)
    #define LDBL_FP80 (__LDBL_MANT_DIG__ == 64)
    ...
    #if !LDBL_FP80
    ...
    #endif

The case failed on x86 architectures with an unusual size for long
doubles, as the test expected the demangler to not be able to demangle
an 80 bit long double (based on the `__LDBL_MANT_DIG__ == 64` condition
in the test). However as the libcxxabi implementation was hardcoded to
demangle 80 bit long doubles on x86_64 regardless of the actual size,
this test failed (by unexpectedly being able to demangle it).

By configuring libcxxabi's demangling of long doubles to match what the
compiler specifies, we no longer hit the expected failures in the
test_demangle.pass.cpp test on Android on x86.

This makes libcxxabi require a GCC-compatible compiler that defines
nonstandard defines like `__LDBL_MANT_DIG__`, but I presume that's
already essentially required anyway.



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list