<html>
    <head>
      <base href="https://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 --- - novtable support"
   href="https://llvm.org/bugs/show_bug.cgi?id=26905">26905</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>novtable support
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

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

        <tr>
          <th>OS</th>
          <td>Windows NT
          </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>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

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

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=16019" name="attach_16019" title="source code">attachment 16019</a> <a href="attachment.cgi?id=16019&action=edit" title="source code">[details]</a></span>
source code

When I tried to use Crypto++ (as static library) with Clang on Windows then I
noticed crash of my application. (without errors during compilation)
The issue was in novtable usage. If I remove novtable then everything works
well.

The example below shows how to reproduce this problem. The names are connected
to class names in Crypto++ where I found the problem.


1. Create static library with class MyClass.h / MyClass.cpp (source also in
Attahcment). Whole program optimization should be disabled.

Source code:

#pragma once

class __declspec(novtable) IteratedHashBase
{
    virtual void Init() = 0;
};

class __declspec(novtable) IteratedHashWithStaticTransform : public
IteratedHashBase
{
public:
    IteratedHashWithStaticTransform() 
    {
        this->Init();
    }

    void Init() 
    {}
};

class MD5 : public IteratedHashWithStaticTransform
{
public:
    static void InitState()    {}
};

2. Create another .exe application, and link this static library.
Source code:

#include "MyClass.h"
#include <cstdio>
int main()
{
    MD5 pY;
    int i;
    scanf("%d", &i);
}


Finally the program compiles properly.
If I use Visual Studio then everything works well.
If I use clang compiler then the program crashes.

In assembly I can see the problem in execution of this->Init(); statement.

I tested it on the last clang snapshot build r262937 (8 March 2016).</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>