[Bug 22314] New: LLDB crashes when evaluating a function which receives a value object which has a virtual destructor

Bug ID 22314
Summary LLDB crashes when evaluating a function which receives a value object which has a virtual destructor
Product lldb
Version unspecified
Hardware PC
OS Linux
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@cs.uiuc.edu
Reporter sivachandra@gmail.com
Classification Unclassified

Consider the following code:

class Foo
{
public:
  virtual ~Foo ();

  int a;
};

Foo::~Foo () {}

Foo
zero1 (Foo f)
{
  Foo foo1;

  foo1.a = -f.a;

  return foo1;
}

Foo 
zero2 ()
{
  Foo f;

  f.a = 0;

  return f;
}

int
zero3 (Foo f)
{
  return -f.a;
}

int
main ()
{
  Foo f;
  return 0; // Break here
}

If after breaking at the marked line, I see this happening:

(lldb) p zero1(f)
Aborted (core dumped)

(lldb) p zero2()
(Foo) $0 = (a = 0)

(lldb) p zero3(f)
Aborted (core dumped)

This issue is probably related to the more general issue reported here:
http://llvm.org/bugs/show_bug.cgi?id=14437

I initially thought that the triviality of the class matters. However, things
work as expected if I make the destructor non-virtual.

Siva Chandra changed bug 22314