<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - LLDB crashes when evaluating a function which receives a value object which has a virtual destructor"
   href="http://llvm.org/bugs/show_bug.cgi?id=22314">22314</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LLDB crashes when evaluating a function which receives a value object which has a virtual destructor
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>lldb
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>lldb-dev@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>sivachandra@gmail.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>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:
<a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Evaluating expressions that contain function calls is broken on Linux"
   href="show_bug.cgi?id=14437">http://llvm.org/bugs/show_bug.cgi?id=14437</a>

I initially thought that the triviality of the class matters. However, things
work as expected if I make the destructor non-virtual.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>