[llvm-bugs] [Bug 25015] New: Importing from external layout broken for template specializations

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Oct 1 12:54:21 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=25015

            Bug ID: 25015
           Summary: Importing from external layout broken for template
                    specializations
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: david.majnemer at gmail.com
          Reporter: zturner at google.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

template<bool b>
struct Foo
{
    virtual ~Foo() {}
    int Member;
};

template<>
struct Foo<false>
{
    int Member;
};

int main(int argc, char **argv)
{
    Foo<true> *f1 = new Foo<true>();
    Foo<false> *f2 = new Foo<false>();
    return 0;
}

$ clang++ -Xclang -fdump-record-layouts-simple -c foo.cpp > foo.layouts
$ clang++ -Xclang -fdump-record-layouts-simple -Xclang
-foverride-record-layout=foo.layouts foo.cpp

Assertion failed: Prior->Kind == MemberInfo::Field && !Prior->FD && "Only
storage fields have tail padding!", file
D:\src\llvm\tools\clang\lib\CodeGen\CGRecordLayoutBuilder.cpp, line 557
0x016D5709 (0x00000016 0x32AEDEFF 0x0683C5E8 0x0683C578), HandleAbort() + 0x9
bytes(s), d:\src\llvm\lib\support\windows\signals.inc, line 296
0x0FAFF7F9 (0x00000016 0x016D5700 0x0683C564 0x0FAF9AC4), raise() + 0x2B9
bytes(s)
0x0FB0B284 (0x0683C5E8 0x0683C578 0x000000BB 0xCCCCCCCC), abort() + 0x34
bytes(s)
0x0FAF9AC4 (0x054EAD30 0x054EAC90 0x0000022D 0x0683C640), _wassert() + 0xD4
bytes(s)
0x01BE6159 (0x0683C900 0x0683C618 0x00000004 0x00000000), `anonymous
namespace'::CGRecordLowering::clipTailPadding() + 0xF9 bytes(s),
d:\src\llvm\tools\clang\lib\codegen\cgrecordlayoutbuilder.cpp, line 557 + 0x3C
byte(s)
0x01BE4C3F (0x00000000 0x0683C978 0x0683D0AC 0xCCCCCCCC), `anonymous
namespace'::CGRecordLowering::lower() + 0x12F bytes(s),
d:\src\llvm\tools\clang\lib\codegen\cgrecordlayoutbuilder.cpp, line 279
0x01BE3F4E (0x06B22FD0 0x06B25668 0x0683CB1C 0x0683D0AC),
clang::CodeGen::CodeGenTypes::ComputeRecordLayout() + 0x4E bytes(s),
d:\src\llvm\tools\clang\lib\codegen\cgrecordlayoutbuilder.cpp, line 692
0x01A2B8B8 (0x06B22FD0 0x0683CCD4 0x0683D0AC 0xCCCCCCCC),
clang::CodeGen::CodeGenTypes::ConvertRecordDeclType() + 0x1E8 bytes(s),
d:\src\llvm\tools\clang\lib\codegen\codegentypes.cpp, line 685 + 0x10 byte(s)
0x01A2A380 (0x06B23080 0xCCCCCCCC 0x06B24580 0x0683CCD4),
clang::CodeGen::CodeGenTypes::ConvertType() + 0x80 bytes(s),
d:\src\llvm\tools\clang\lib\codegen\codegentypes.cpp, line 305 + 0x11 byte(s)
0x01A2B103 (0x06B23080 0x0683CEB4 0x0683D0AC 0xCCCCCCCC),
clang::CodeGen::CodeGenTypes::ConvertTypeForMem() + 0x23 bytes(s),
d:\src\llvm\tools\clang\lib\codegen\codegentypes.cpp, line 84 + 0xC byte(s)
0x01A2A6A4 (0x06B230F0 0xCCCCCCCC 0x06B24580 0x0683CCF8),
clang::CodeGen::CodeGenTypes::ConvertType() + 0x3A4 bytes(s),
d:\src\llvm\tools\clang\lib\codegen\codegentypes.cpp, line 435 + 0xC byte(s)
0x01A2B103 (0x06B23110 0x0683D1FC 0x0683CEB4 0x01AFF1B3),
clang::CodeGen::CodeGenTypes::ConvertTypeForMem() + 0x23 bytes(s),
d:\src\llvm\tools\clang\lib\codegen\codegentypes.cpp, line 84 + 0xC byte(s)
0x01ADA1C4 (0x06B23110 0x0683CEFC 0x0683D0AC 0x00000000),
clang::CodeGen::CodeGenFunction::ConvertTypeForMem() + 0x24 bytes(s),
d:\src\llvm\tools\clang\lib\codegen\codegenfunction.cpp, line 163
0x01AFF1B3 (0x0683CECC 0x06B23150 0x0683CF54 0xCCCCCCCC),
clang::CodeGen::CodeGenFunction::EmitAutoVarAlloca() + 0x403 bytes(s),
d:\src\llvm\tools\clang\lib\codegen\cgdecl.cpp, line 967 + 0xC byte(s)

Problem only happens when specializating a template (fully or partially) and
also requires a virtual function in one of the specializations.  The output of
`foo.layouts` looks normal, so the problem seems to be unrelated to the layout
algorithm itself, and more to do with reading the layout algorithm in from a
dump.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20151001/24f844ed/attachment.html>


More information about the llvm-bugs mailing list