[LLVMbugs] [Bug 11124] New: Virtual inheritance segfault
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Thu Oct 13 11:30:48 PDT 2011
http://llvm.org/bugs/show_bug.cgi?id=11124
Summary: Virtual inheritance segfault
Product: clang
Version: 2.9
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: C++
AssignedTo: unassignedclangbugs at nondot.org
ReportedBy: tomboshoven at gmail.com
CC: llvmbugs at cs.uiuc.edu, dgregor at apple.com
The following C++ code gives a segfault when executed.
struct Base
{
const int text;
Base():text(1) {}
Base(int aText)
: text(aText) {}
};
struct SubA : public virtual Base
{
protected:
int x;
public:
SubA(int aX)
: x(aX) {}
};
class SubB : public virtual Base
{};
struct Diamond : public SubA, public SubB
{
Diamond(int text)
: Base(text), SubA(5), SubB() {}
void printText()
{
if(text != 2)
__builtin_abort();
if(x!=5)
__builtin_abort();
}
};
int main(int, char**)
{
Diamond x(2);
x.printText();
}
Incidentally, the same problem existed as a regression in gcc:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50618
Compilation was done on clang version 2.9 (tags/RELEASE_29/final).
Target: x86_64-unknown-linux-gnu.
Default Arch Linux distribution.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list