[PATCH] D23001: XFAIL one sanitizer symbolizer test for FreeBSD

Dimitry Andric via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 31 12:46:23 PDT 2016


dim added a comment.

In https://reviews.llvm.org/D23001#501701, @emaste wrote:

> There's also an issue here in the sanitizer: what `DemangleSwiftAndCXX("f")` should return is ambiguous.


Both on FreeBSD, Linux and OSX calling __cxa_demangle() with "f" always returns "float".  So I guess that is at least a de facto 'correct' result.

As far as I can see in asan and ubsan, where the demangler is called, it always uses external knowledge about the symbol to see whether it should be demangled at all.  For instance, lib/asan/asan_report.cc's `MaybeDemangleGlobalName()`:

  static const char *MaybeDemangleGlobalName(const char *name) {
    // We can spoil names of globals with C linkage, so use an heuristic
    // approach to check if the name should be demangled.
    bool should_demangle = false;
    if (name[0] == '_' && name[1] == 'Z')
      should_demangle = true;
    else if (SANITIZER_WINDOWS && name[0] == '\01' && name[1] == '?')
      should_demangle = true;
  
    return should_demangle ? Symbolizer::GetOrInit()->Demangle(name) : name;
  }


https://reviews.llvm.org/D23001





More information about the llvm-commits mailing list