[cfe-dev] [libc++abi] demangle fails to handle SSE2 types

Luc Bourhis luc_j_bourhis at mac.com
Wed May 23 02:53:56 PDT 2012


Hi,

I am not sure whether it is fine to discuss libc++abi here but since libc++ is welcome a subject, I boldly extrapolated…

So,  abi::__cxa_demangle from libc++abi trunk fails to demangle SSE2 types such as __m128. This is demonstrated by the following snippet:

//*********************************************************************************
#include <iostream>
#include <cxxabi.h>
#include <immintrin.h>

template <class T>
void pretty_print(T const &o) {
  char const *mangled = typeid(o).name();
  int status;
  char *demangled = abi::__cxa_demangle(mangled, 0, 0, &status);
  std::cout << "Mangled: " << mangled << "\n";
  if (status) {
    std::cout << "Demangling failed with status " << status << "\n";
  }
  else {
    std::cout << "Demangled: " << demangled << "\n";
  }
  std::cout << std::endl;
}

int main() {
  double x0;
  __m128 x1;
  __m128d x2;
  pretty_print(x0);
  pretty_print(x1);
  pretty_print(x2);
}
//************************************************************************************

which prints

Mangled: d
Demangled: double

Mangled: Dv4_f
Demangling failed with status -2

Mangled: Dv2_d
Demangling failed with status -2

Best wishes,

Luc Bourhis






More information about the cfe-dev mailing list