<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 --- - [-cxx-abi microsoft] Layout calculation leads to assertion failure"
   href="http://llvm.org/bugs/show_bug.cgi?id=18169">18169</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>[-cxx-abi microsoft] Layout calculation leads to assertion failure
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>clang
          </td>
        </tr>

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

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

        <tr>
          <th>OS</th>
          <td>All
          </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>LLVM Codegen
          </td>
        </tr>

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

        <tr>
          <th>Reporter</th>
          <td>david.majnemer@gmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>consider:
#if defined(__clang__) || defined(__GNUC__)
typedef __SIZE_TYPE__ size_t;
#endif
static char buffer[419430400];
inline void *operator new(size_t, void *pv) {}
struct ClassName0 {};
struct ClassName1 : public ClassName0 {};
struct ClassName2 : public virtual ClassName0 {};
struct ClassName3 : public ClassName1, public virtual ClassName2 {
  char : 9;
  bool ClassName3FieldName2;
};
static void test_layout(const char *class_name, size_t size_of_class,
                        size_t align_of_class) {}
template <typename Class>
static void init_mem() {
  new (buffer) Class;
}
#define test(Class) \
  init_mem<Class>(), test_layout(#Class, sizeof(Class), __alignof(Class))
int main() { test(ClassName3); }

leads to:
different.cpp:34:2: warning: size of anonymous bit-field (9 bits) exceeds size
of its type; value will be truncated to 8 bits
        char : 9;
        ^
clang: ~/llvm/src/tools/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp:348: bool
{anonymous}::CGRecordLayoutBuilder::LayoutBitfields(const
clang::ASTRecordLayout&, unsigned int&, clang::RecordDecl::field_iterator&,
clang::RecordDecl::field_iterator): Assertion `EndOffset >= (FirstFieldOffset +
TotalBits) && "End offset is not past the end of the known storage bits."'
failed.
0  clang           0x0000000001e7e937 llvm::sys::PrintStackTrace(_IO_FILE*) +
38
1  clang           0x0000000001e7ebbe
2  clang           0x0000000001e7e602
3  libpthread.so.0 0x00007f39b5f08cb0
4  libc.so.6       0x00007f39b535d425 gsignal + 53
5  libc.so.6       0x00007f39b5360b8b abort + 379
6  libc.so.6       0x00007f39b53560ee
7  libc.so.6       0x00007f39b5356192
8  clang           0x0000000001efc34f
9  clang           0x0000000001efdc6a
10 clang           0x0000000001efbbe2
11 clang           0x0000000001efe630
clang::CodeGen::CodeGenTypes::ComputeRecordLayout(clang::RecordDecl const*,
llvm::StructType*) + 98
12 clang           0x0000000001f8fa5d
clang::CodeGen::CodeGenTypes::ConvertRecordDeclType(clang::RecordDecl const*) +
589
13 clang           0x0000000001f8e850
clang::CodeGen::CodeGenTypes::ConvertType(clang::QualType) + 176
14 clang           0x0000000001f8e022
clang::CodeGen::CodeGenTypes::ConvertTypeForMem(clang::QualType) + 36
15 clang           0x0000000001f208bf
clang::CodeGen::CodeGenFunction::ConvertTypeForMem(clang::QualType) + 47
16 clang           0x0000000002045af5
clang::CodeGen::CodeGenFunction::EmitCXXNewExpr(clang::CXXNewExpr const*) +
1913
17 clang           0x000000000204af8a
18 clang           0x000000000205ad69
19 clang           0x0000000002049fcf
20 clang           0x0000000002059c77
clang::CodeGen::CodeGenFunction::EmitScalarExpr(clang::Expr const*, bool) + 159
21 clang           0x0000000002013635
clang::CodeGen::CodeGenFunction::EmitAnyExpr(clang::Expr const*,
clang::CodeGen::AggValueSlot, bool) + 101
22 clang           0x0000000002013585
clang::CodeGen::CodeGenFunction::EmitIgnoredExpr(clang::Expr const*) + 127
23 clang           0x0000000001f07712
clang::CodeGen::CodeGenFunction::EmitStmt(clang::Stmt const*) + 400
24 clang           0x0000000001f07db9
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope(clang::CompoundStmt
const&, bool, clang::CodeGen::AggValueSlot) + 109
25 clang           0x0000000001f2318f
clang::CodeGen::CodeGenFunction::EmitFunctionBody(clang::CodeGen::FunctionArgList&,
clang::Stmt const*) + 113
26 clang           0x0000000001f238c3
clang::CodeGen::CodeGenFunction::GenerateCode(clang::GlobalDecl,
llvm::Function*, clang::CodeGen::CGFunctionInfo const&) + 1347
27 clang           0x0000000001f357df
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition(clang::GlobalDecl)
+ 1051
28 clang           0x0000000001f32c7d
clang::CodeGen::CodeGenModule::EmitGlobalDefinition(clang::GlobalDecl) + 395
29 clang           0x0000000001f316e9
clang::CodeGen::CodeGenModule::EmitDeferred() + 341
30 clang           0x0000000001f2e6c9 clang::CodeGen::CodeGenModule::Release()
+ 25
31 clang           0x0000000001eb88bd
32 clang           0x0000000001eb7527
33 clang           0x0000000002292140 clang::ParseAST(clang::Sema&, bool, bool)
+ 776
34 clang           0x0000000002189c9b clang::ASTFrontendAction::ExecuteAction()
+ 321
35 clang           0x0000000001eb643c clang::CodeGenAction::ExecuteAction() +
1414
36 clang           0x00000000021897da clang::FrontendAction::Execute() + 200
37 clang           0x0000000002161e6c
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 720
38 clang           0x0000000001e85116
clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1018
39 clang           0x0000000000d0f283 cc1_main(char const**, char const**, char
const*, void*) + 717</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>