[llvm-bugs] [Bug 35646] New: Clang++ creates symbol it cannot demangle.

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Dec 12 11:47:44 PST 2017


            Bug ID: 35646
           Summary: Clang++ creates symbol it cannot demangle.
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: huangs at google.com
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org

Consider the following program, saved as "a.cc"

**** a.cc ****
#include <string>

std::string get_value() {
  return "sparrow";

int main() {
  static const std::string& weird = get_value();
  return 0;

Build, get symbol for |weird| and demangle:

  clang++ a.cc
  llvm-nm a.out | grep weird     # Output 1
  llvm-nm a.out --demangle | grep weird    # Output 2


**** Output 1 ****
00000000006010a0 b _ZGRZ4mainE5weird_
0000000000601098 b _ZGVZ4mainE5weird
0000000000601090 b _ZZ4mainE5weird

**** Output 2 ****
00000000006010a0 b _ZGRZ4mainE5weird_
0000000000601098 b guard variable for main::weird
0000000000601090 b main::weird

So "_ZGRZ4mainE5weird_" cannot be demangled (llvm-cxxfilt does not work
either).  Interestingly, c++filt can demangle it as:

  reference temporary #0 for main::weird

So it seems one of the following is broken:

(1) Mangled name generation producing an invalid value.
(2) Demangling not properly working (perhaps with extension).

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20171212/525e7f94/attachment.html>

More information about the llvm-bugs mailing list