[lldb-dev] [Bug 20781] New: LLDB asserts "Cannot get layout of forward declarations!" from RecordLayoutBuilder.cpp:2782

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Aug 27 18:07:04 PDT 2014


http://llvm.org/bugs/show_bug.cgi?id=20781

            Bug ID: 20781
           Summary: LLDB asserts "Cannot get layout of forward
                    declarations!" from RecordLayoutBuilder.cpp:2782
           Product: lldb
           Version: unspecified
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at cs.uiuc.edu
          Reporter: chandlerc at gmail.com
                CC: david.majnemer at gmail.com, dblaikie at gmail.com,
                    tfiala at google.com
    Classification: Unclassified

Steps to reproduce on Linux x86-64 (sorry this is huge):

1) Checkout LLVM. I was at r216571, but I doubt it was that specific.

2) Build 'llc' with a modern Clang host compiler in a boring CMake/Ninja
'debug' build ('-g' is the debug symbol option).

3) Grab this input to llc into a file (it's some code from Bullet):

% cat t.ll
target datalayout =
"e-p:64:64:64-i1:8:8-i8:8:8-i16:16:16-i32:32:32-i64:64:64-f32:32:32-f64:64:64-v64:64:64-v128:128:128-a0:0:64-s0:64:64-f80:128:128-n8:16:32:64-S128"
%btTransform = type { %btMatrix3x3, %btVector3 }
%btMatrix3x3 = type { [3 x %btVector3] }
%btVector3 = type { [4 x float] }
define void @_ZN7RagDollC2EP15btDynamicsWorldRK9btVector3f() unnamed_addr
noreturn uwtable ssp align 2 {
  %localA = alloca %btTransform, align 4
  %m_basis.i = getelementptr inbounds %btTransform* %localA, i64 0, i32 0
  %call5.i = call float @sinx() nounwind
  %mul20.i = fmul float %call5.i, fmul (float undef, float undef)
  %sub21.i = fsub float %mul20.i, undef
  %arrayidx.i1.i.i = getelementptr inbounds %btMatrix3x3* %m_basis.i, i64 0,
i32 0, i64 1, i32 0, i64 0
  %1 = bitcast float* %arrayidx.i1.i.i to <4 x float>*
  %2 = insertelement <2 x float> undef, float %sub21.i, i32 0
  %3 = insertelement <2 x float> %2, float 0.000000e+00, i32 1
  %4 = shufflevector <2 x float> <float undef, float 0.000000e+00>, <2 x float>
%3, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
  store <4 x float> %4, <4 x float>* %1, align 4
  %m_basis.i1 = getelementptr inbounds %btTransform* %localA, i64 0, i32 0
  %arrayidx5.i.i.i.i = getelementptr inbounds %btMatrix3x3* %m_basis.i1, i64 0,
i32 0, i64 0, i32 0, i64 2
  %5 = bitcast float* %arrayidx5.i.i.i.i to i8*
  call void @llvm.memset.p0i8.i64(i8* %5, i8 0, i64 16, i32 4, i1 false)
nounwind
  ret void
}
declare float @sinx() nounwind readnone
declare void @llvm.memset.p0i8.i64(i8* nocapture, i8, i64, i32, i1) nounwind

3) Run the built llc binary under lldb as follows:

% lldb -- path/to/llc -o - t.ll -mcpu=x86-64
-x86-experimental-vector-shuffle-lowering -debug
(lldb) target create "./bin/llc"
Current executable set to './bin/llc' (x86_64).
(lldb) settings set -- target.run-args  "-o" "-" "t.ll" "-mcpu=x86-64"
"-x86-experimental-vector-shuffle-lowering" "-debug"
(lldb) b X86ISelLowering.cpp:6798
Breakpoint 1: where =
llc`llvm::X86TargetLowering::LowerBUILD_VECTOR(llvm::SDValue,
llvm::SelectionDAG&) const + 6447 at X86ISelLowering.cpp:6798, address =
0x0000000000f89c5f
(lldb) r
Process 16367 launching
Process 16367 stopped
* thread #1: tid = 16367, 0x00007ffff7ddb2d0, name = 'llc', stop reason = trace
    frame #0: 0x00007ffff7ddb2d0
error: No such process
Process 16367 launched: './bin/llc' (x86_64)
Args: ./bin/llc -o - t.ll -mcpu=x86-64
-x86-experimental-vector-shuffle-lowering -debug 

Features:+64bit,+sse2
CPU:x86-64

<snip>

Legalizing: 0x2a2d1e0: v4f32 = BUILD_VECTOR 0x2a2add0, 0x2a2d0d8, 0x2a2b0e8,
0x2a2d0d8 [ORD=11] [ID=23]
Process 16367 stopped
* thread #1: tid = 16367, 0x0000000000f89c5f
llc`llvm::X86TargetLowering::LowerBUILD_VECTOR(this=0x00000000029cfef0,
Op=SDValue at 0x00007fffffffbcd8, DAG=0x00000000029fa010) const + 6447 at
X86ISelLowering.cpp:6798, name = 'llc', stop reason = breakpoint 1.1
    frame #0: 0x0000000000f89c5f
llc`llvm::X86TargetLowering::LowerBUILD_VECTOR(this=0x00000000029cfef0,
Op=SDValue at 0x00007fffffffbcd8, DAG=0x00000000029fa010) const + 6447 at
X86ISelLowering.cpp:6798
   6795
   6796       // Turn it into a shuffle of zero and zero-extended scalar to
vector.
   6797       Item = getShuffleVectorZeroOrUndef(Item, 0, NumZero > 0,
Subtarget, DAG);
-> 6798       SmallVector<int, 8> MaskVec;
   6799       for (unsigned i = 0; i != NumElems; ++i)
   6800         MaskVec.push_back(i == Idx ? 0 : 1);
   6801       return DAG.getVectorShuffle(VT, dl, Item, DAG.getUNDEF(VT),
&MaskVec[0]);
(lldb) p Item->dumpr()
lldb: ../tools/clang/lib/AST/RecordLayoutBuilder.cpp:2782: const
clang::ASTRecordLayout &clang::ASTContext::getASTRecordLayout(const
clang::RecordDecl *) const: Assertion `D && "Cannot get layout of forward
declarations!"' failed.
zsh: abort (core dumped)  lldb -- ./bin/llc -o - t.ll -mcpu=x86-64  -debug


Since this might well be a matter of LLDB and Clang disagreeing about how much
debug information should be emitted, CC-ing folks that work on the debug info
side of things as well.

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20140828/76800e0b/attachment.html>


More information about the lldb-dev mailing list