Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

llvm-cxxfilt build configurations can show formatting differences for floating point literals #92087

Open
bd1976bris opened this issue May 14, 2024 · 1 comment

Comments

@bd1976bris
Copy link
Collaborator

bd1976bris commented May 14, 2024

namespace cxx20 {
  template<auto> struct A {};
  void f(A<1.0>) {}
};

Is mangled as _ZN5cxx201fENS_1AILd3ff0000000000000EEE.

For a Visual Studio 2019 build llvm-cxxfilt demangles as cxx20::f(cxx20::A<0x1.0000000000000p+0>) however for a Linux build with glibc it is demanged as: cxx20::f(cxx20::A<0x1p+0>). This occurs as the implementation calls snprintf and the differing implementations have minor output variations. See:

int n = snprintf(num, sizeof(num), FloatData<Float>::spec, value);

Ideally, the output of llvm-cxxfilt should be consistent.

One solution might be just to dump the hexadecimal string from the mangled name. This would match what GNU appears to do. For example GNU cxxfilt demangles to: cxx20::f(cxx20::A<(double)[3ff0000000000000]>). See: #92081 for, possibly, more motivation for just dumping the hexadecimal string.

@llvmbot
Copy link
Collaborator

llvmbot commented May 14, 2024

@llvm/issue-subscribers-tools-llvm-cxxfilt

Author: bd1976bris (bd1976bris)

``` namespace cxx20 { template<auto> struct A {}; void f(A<1.0>) {} }; ``` Is mangled as `_ZN5cxx201fENS_1AILd3ff0000000000000EEE`.

For a Visual Studio 2019 build llvm-cxxfilt demangles as cxx20::f(cxx20::A&lt;0x1.0000000000000p+0&gt;) however for a Linux build with glibc it is demanged as: cxx20::f(cxx20::A&lt;0x1p+0&gt;). This occurs as the implementation calls snprintf and the differing implementations have minor output variations. See:

int n = snprintf(num, sizeof(num), FloatData<Float>::spec, value);

Ideally, the output of the llvm-cxxfilt should be consistent.

One solution might be just to dump the hexadecimal string from the mangled name. This would match what GNU appears to do. For example GNU cxxfilt demangles to: cxx20::f(cxx20::A&lt;(double)[3ff0000000000000]&gt;). See: #92081 for, possibly, more motivation for just dumping the hexadecimal string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants