[LLVMbugs] [Bug 17845] New: MicrosoftRecordLayoutBuilder yields wrong info on the presence of vfptr

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Fri Nov 8 05:00:33 PST 2013


http://llvm.org/bugs/show_bug.cgi?id=17845

            Bug ID: 17845
           Summary: MicrosoftRecordLayoutBuilder yields wrong info on the
                    presence of vfptr
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: timurrrr at google.com
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Steps to repro as of r194205:

1) Apply the following diff:
----------------------------------------------
Index: lib/AST/RecordLayoutBuilder.cpp
===================================================================
--- lib/AST/RecordLayoutBuilder.cpp    (revision 194256)
+++ lib/AST/RecordLayoutBuilder.cpp    (working copy)
@@ -2904,6 +2904,9 @@
   bool HasOwnVFPtr = Layout.hasOwnVFPtr();
   bool HasOwnVBPtr = Layout.hasOwnVBPtr();

+  if (IndentLevel == 1)
+    OS << (Layout.hasVFPtr() ? "-- has vfptr --\n" : "-- doesn't have vfptr
--\n");
+
   // Vtable pointer.
   if (RD->isDynamicClass() && !PrimaryBase && !isMsLayout(RD)) {
     PrintOffset(OS, Offset, IndentLevel);
----------------------------------------------

2) Dump the AST layout for the following code:
----------------------------------------------
class X { virtual void f(); int x; };
class A : virtual X { int a; };
----------------------------------------------
I get this:
----------------------------------------------
*** Dumping AST Record Layout
   0 | class A
-- doesn't have vfptr --
   0 |   (A vbtable pointer)
   4 |   int a
   8 |   class X (virtual base)
   8 |     (X vftable pointer)
  12 |     int x
----------------------------------------------

It's pretty clear that the result of Layout.hasVFPtr() is wrong.

-- 
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/20131108/5d778224/attachment.html>


More information about the llvm-bugs mailing list