[LLVMbugs] [Bug 23878] New: [ms] virtual member pointer call gets miscompiled

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 17 14:07:56 PDT 2015


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

            Bug ID: 23878
           Summary: [ms] virtual member pointer call gets miscompiled
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nicolasweber at gmx.de
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Consider:

C:\src\chrome\src\out\Debug>type repro.cc
struct Channel { virtual void Connect() = 0; };

struct SupportsAttachmentBrokering { virtual void GetAttachmentBroker() = 0; };
struct ChannelReader : virtual public SupportsAttachmentBrokering {
  void GetAttachmentBroker() override {}
};

struct ChannelWin : public Channel, public ChannelReader {
  void Connect() override {
    void (ChannelWin::*ptr)() = &ChannelWin::OnIOCompleted;
    (this->*ptr)();  // crashes
  }
  virtual void OnIOCompleted() {}
};

int main() {
  ChannelWin channel;
  channel.Connect();
}


This program runs fine when build with cl.exe, but crashes when built with
clang-cl.exe:

C:\src\chrome\src\out\Debug>cl repro.cc /Feasdf && asdf
Microsoft (R) C/C++ Optimizing Compiler Version 18.00.31101 for x86
Copyright (C) Microsoft Corporation.  All rights reserved.

repro.cc
Microsoft (R) Incremental Linker Version 12.00.31101.0
Copyright (C) Microsoft Corporation.  All rights reserved.

/out:asdf.exe
repro.obj

C:\src\chrome\src\out\Debug>"..\..\third_party/llvm-build/Release+Asserts/bin/clang-cl"
-m32 repro.cc /Feasdf.exe && asdf

# ^ This makes a "asdf.ese has stopped working" dialog appear

-- 
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/20150617/56345480/attachment.html>


More information about the llvm-bugs mailing list