[llvm-bugs] [Bug 31931] New: [Windows] Incorrect name mangling for "vbase destructor".

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Feb 10 12:03:10 PST 2017


https://llvm.org/bugs/show_bug.cgi?id=31931

            Bug ID: 31931
           Summary: [Windows] Incorrect name mangling for "vbase
                    destructor".
           Product: clang
           Version: 3.9
          Hardware: PC
                OS: Windows XP
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: eric at andante.org
                CC: dgregor at apple.com, llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 17966
  --> https://llvm.org/bugs/attachment.cgi?id=17966&action=edit
Testcase which demonstrates the bug.

There are a couple of name mangling bugs in llvm/clang that I am noticing -
they always seem to have to do with "vbase destructors".  The enclosed testcase
demonstrates this.

Clang generates symbol references like such:

  0:0000000 T ??_Dbasic_istream@@UAE at XZ
  0:0000000 T ??_Dbasic_istringstream@@UAE at XZ

The same source, when compiled with visual studio 2013, generates these symbols
in the object file:

   0:0000000 ? ??_Dbasic_istream@@QAEXXZ
   0:0000000 ? ??_Dbasic_istringstream@@QAEXXZ

And you should see that there are slight differences in the mangled names.  The
microsoft demangling tool decodes these as follows:

Undecoration of :- "??_Dbasic_istream@@UAE at XZ"
is :- "public: virtual __thiscall basic_istream::`vbase destructor'(void)"

Undecoration of :- "??_Dbasic_istream@@QAEXXZ"
is :- "public: void __thiscall basic_istream::`vbase destructor'(void)"

The only difference in the names is towards the end.  Clang is using an '@' in
the 3rd from the end, which signifies an unspecified return type.  Visual
studio uses a 'X', which signifies a void return type.  This is generated in

MicrosoftCXXNameMangler::mangleFunctionType()

The second issue is 6th from the end.  Clang is using a 'U', Visual Studio is
using a 'Q'.  The 'U' signifies "virtual".  My guess is that it is redundant to
have this set for a vbase destructor, but I guess the reason is unimportant in
that this is a difference from what Microsoft compilers are generating

This is set in MicrosoftCXXNameMangler::mangleFunctionClass()

It wasn't hard to follow through to see how clang came up with the mangled name
that it did, but it isn't at all obvious to me what the correct fix should be.

-- 
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/20170210/687ea9ea/attachment.html>


More information about the llvm-bugs mailing list