[Bug 15256] New: lldb asserts on linux in RecordLayoutBuilder::updateExternalFieldOffset

Bug ID 15256
Summary lldb asserts on linux in RecordLayoutBuilder::updateExternalFieldOffset
Product lldb
Version unspecified
Hardware PC
OS Linux
Status NEW
Severity normal
Priority P
Component All Bugs
Assignee lldb-dev@cs.uiuc.edu
Reporter daniel.malea@intel.com
Classification Unclassified

Multiple test-cases reproduce this crash on x86_64 builds of LLDB trunk; for
example, run:

python dotest.py expression_command/call-function

The stack trace for the crash is:

#2  0x00007ffff6f130ee in __assert_fail_base (fmt=<optimized out>,
assertion=0x7ffff433b070 "ExternalFieldOffsets.find(Field) !=
ExternalFieldOffsets.end() && \"Field does not have an external offset\"",
file=0x7ffff433a7b0
"/home/daniel/dev/llvm/tools/clang/lib/AST/RecordLayoutBuilder.cpp", 
    line=<optimized out>, function=<optimized out>) at assert.c:94
#3  0x00007ffff6f13192 in __GI___assert_fail (assertion=0x7ffff433b070
"ExternalFieldOffsets.find(Field) != ExternalFieldOffsets.end() && \"Field does
not have an external offset\"", file=0x7ffff433a7b0
"/home/daniel/dev/llvm/tools/clang/lib/AST/RecordLayoutBuilder.cpp", line=2271,
function=
    0x7ffff4340fe0 <(anonymous
namespace)::RecordLayoutBuilder::updateExternalFieldOffset(clang::FieldDecl
const*, unsigned long)::__PRETTY_FUNCTION__> "uint64_t
{anonymous}::RecordLayoutBuilder::updateExternalFieldOffset(const
clang::FieldDecl*, uint64_t)") at assert.c:103
#4  0x00007ffff2688976 in (anonymous
namespace)::RecordLayoutBuilder::updateExternalFieldOffset
(this=0x7fffffff8300, Field=0x147b970, ComputedOffset=0) at
/home/daniel/dev/llvm/tools/clang/lib/AST/RecordLayoutBuilder.cpp:2270
#5  0x00007ffff2687fa5 in (anonymous
namespace)::RecordLayoutBuilder::LayoutField (this=0x7fffffff8300, D=0x147b970)
at /home/daniel/dev/llvm/tools/clang/lib/AST/RecordLayoutBuilder.cpp:2136
#6  0x00007ffff2686b1e in (anonymous
namespace)::RecordLayoutBuilder::LayoutFields (this=0x7fffffff8300,
D=0x147b5d0) at
/home/daniel/dev/llvm/tools/clang/lib/AST/RecordLayoutBuilder.cpp:1835
#7  0x00007ffff2685dba in (anonymous namespace)::RecordLayoutBuilder::Layout
(this=0x7fffffff8300, RD=0x147b5d0) at
/home/daniel/dev/llvm/tools/clang/lib/AST/RecordLayoutBuilder.cpp:1651
#8  0x00007ffff26891db in clang::ASTContext::getASTRecordLayout
(this=0x13f61d0, D=0x147b5d0) at
/home/daniel/dev/llvm/tools/clang/lib/AST/RecordLayoutBuilder.cpp:2484
#9  0x00007ffff20fbeb1 in lldb_private::ClangASTSource::layoutRecordType
(this=0x13ff360, record=0x14b1ea0, size=@0x7fffffff8db0: 140737230128320,
alignment=@0x7fffffff8db8: 140737227747732, field_offsets=...,
base_offsets=..., virtual_base_offsets=...)
    at
/home/daniel/dev/llvm/tools/lldb/source/Expression/ClangASTSource.cpp:1467
#10 0x00007ffff211d805 in
lldb_private::ClangASTSource::ClangASTSourceProxy::layoutRecordType
(this=0x1456dc0, Record=0x14b1ea0, Size=@0x7fffffff8db0: 140737230128320,
Alignment=@0x7fffffff8db8: 140737227747732, FieldOffsets=..., BaseOffsets=...,
VirtualBaseOffsets=...)
    at
/home/daniel/dev/llvm/tools/lldb/source/Expression/../../include/lldb/Expression/ClangASTSource.h:291
#11 0x00007ffff2685c9c in (anonymous
namespace)::RecordLayoutBuilder::InitializeLayout (this=0x7fffffff8b00,
D=0x14b1ea0) at
/home/daniel/dev/llvm/tools/clang/lib/AST/RecordLayoutBuilder.cpp:1622
#12 0x00007ffff2685d94 in (anonymous namespace)::RecordLayoutBuilder::Layout
(this=0x7fffffff8b00, RD=0x14b1ea0) at
/home/daniel/dev/llvm/tools/clang/lib/AST/RecordLayoutBuilder.cpp:1646
#13 0x00007ffff26891db in clang::ASTContext::getASTRecordLayout
(this=0x144fde0, D=0x14b1ea0) at
/home/daniel/dev/llvm/tools/clang/lib/AST/RecordLayoutBuilder.cpp:2484
#14 0x00007ffff28830a1 in (anonymous namespace)::CGRecordLayoutBuilder::Layout
(this=0x7fffffff8fb0, D=0x14b1ea0) at
/home/daniel/dev/llvm/tools/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp:208
#15 0x00007ffff2885cb8 in clang::CodeGen::CodeGenTypes::ComputeRecordLayout
(this=0x145f190, D=0x14b1ea0, Ty=0x1460ff0) at
/home/daniel/dev/llvm/tools/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp:969
#16 0x00007ffff28ef854 in clang::CodeGen::CodeGenTypes::ConvertRecordDeclType
(this=0x145f190, RD=0x14b1ea0) at
/home/daniel/dev/llvm/tools/clang/lib/CodeGen/CodeGenTypes.cpp:638
#17 0x00007ffff28ee877 in clang::CodeGen::CodeGenTypes::ConvertType
(this=0x145f190, T=...) at
/home/daniel/dev/llvm/tools/clang/lib/CodeGen/CodeGenTypes.cpp:295
#18 0x00007ffff28ee070 in clang::CodeGen::CodeGenTypes::ConvertTypeForMem
(this=0x145f190, T=...) at
/home/daniel/dev/llvm/tools/clang/lib/CodeGen/CodeGenTypes.cpp:88
#19 0x00007ffff28eec9f in clang::CodeGen::CodeGenTypes::ConvertType
(this=0x145f190, T=...) at
/home/daniel/dev/llvm/tools/clang/lib/CodeGen/CodeGenTypes.cpp:412
#20 0x00007ffff28ee070 in clang::CodeGen::CodeGenTypes::ConvertTypeForMem
(this=0x145f190, T=...) at
/home/daniel/dev/llvm/tools/clang/lib/CodeGen/CodeGenTypes.cpp:88
#21 0x00007ffff27c4c41 in clang::CodeGen::CodeGenFunction::CreateStaticVarDecl
(this=0x7fffffff9c00, D=..., Separator=0x7ffff441dda7 ".",
Linkage=llvm::GlobalValue::InternalLinkage) at
/home/daniel/dev/llvm/tools/clang/lib/CodeGen/CGDecl.cpp:186
#22 0x00007ffff27c52a4 in clang::CodeGen::CodeGenFunction::EmitStaticVarDecl
(this=0x7fffffff9c00, D=..., Linkage=llvm::GlobalValue::InternalLinkage) at
/home/daniel/dev/llvm/tools/clang/lib/CodeGen/CGDecl.cpp:292
#23 0x00007ffff27c45ed in clang::CodeGen::CodeGenFunction::EmitVarDecl
(this=0x7fffffff9c00, D=...) at
/home/daniel/dev/llvm/tools/clang/lib/CodeGen/CGDecl.cpp:128
#24 0x00007ffff27c44cd in clang::CodeGen::CodeGenFunction::EmitDecl
(this=0x7fffffff9c00, D=...) at
/home/daniel/dev/llvm/tools/clang/lib/CodeGen/CGDecl.cpp:93
#25 0x00007ffff288c663 in clang::CodeGen::CodeGenFunction::EmitDeclStmt
(this=0x7fffffff9c00, S=...) at
/home/daniel/dev/llvm/tools/clang/lib/CodeGen/CGStmt.cpp:815
#26 0x00007ffff2889f07 in clang::CodeGen::CodeGenFunction::EmitSimpleStmt
(this=0x7fffffff9c00, S=0x14b2298) at
/home/daniel/dev/llvm/tools/clang/lib/CodeGen/CGStmt.cpp:176
#27 0x00007ffff28899d7 in clang::CodeGen::CodeGenFunction::EmitStmt
(this=0x7fffffff9c00, S=0x14b2298) at
/home/daniel/dev/llvm/tools/clang/lib/CodeGen/CGStmt.cpp:47
#28 0x00007ffff288a183 in
clang::CodeGen::CodeGenFunction::EmitCompoundStmtWithoutScope
(this=0x7fffffff9c00, S=..., GetLast=false, AggSlot=...) at
/home/daniel/dev/llvm/tools/clang/lib/CodeGen/CGStmt.cpp:209
#29 0x00007ffff28a3d1f in clang::CodeGen::CodeGenFunction::EmitFunctionBody
(this=0x7fffffff9c00, Args=...) at
/home/daniel/dev/llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp:494
#30 0x00007ffff28a42a0 in clang::CodeGen::CodeGenFunction::GenerateCode
(this=0x7fffffff9c00, GD=..., Fn=0x14b50e0, FnInfo=...) at
/home/daniel/dev/llvm/tools/clang/lib/CodeGen/CodeGenFunction.cpp:564
#31 0x00007ffff28b1d83 in
clang::CodeGen::CodeGenModule::EmitGlobalFunctionDefinition (this=0x145f0f0,
GD=...) at /home/daniel/dev/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:2050
#32 0x00007ffff28ae969 in clang::CodeGen::CodeGenModule::EmitGlobalDefinition
(this=0x145f0f0, GD=...) at
/home/daniel/dev/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:1217
#33 0x00007ffff28ae2cb in clang::CodeGen::CodeGenModule::EmitGlobal
(this=0x145f0f0, GD=...) at
/home/daniel/dev/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:1093
#34 0x00007ffff28b5033 in clang::CodeGen::CodeGenModule::EmitTopLevelDecl
(this=0x145f0f0, D=0x1465910) at
/home/daniel/dev/llvm/tools/clang/lib/CodeGen/CodeGenModule.cpp:2718
#35 0x00007ffff28f9859 in (anonymous
namespace)::CodeGeneratorImpl::HandleTopLevelDecl (this=0x1458120, DG=...) at
/home/daniel/dev/llvm/tools/clang/lib/CodeGen/ModuleBuilder.cpp:69
#36 0x00007ffff20f2951 in
lldb_private::ASTResultSynthesizer::HandleTopLevelDecl (this=0x1459820, D=...)
at
/home/daniel/dev/llvm/tools/lldb/source/Expression/ASTResultSynthesizer.cpp:125
#37 0x00007ffff2abe55c in clang::ParseAST (S=..., PrintStats=false,
SkipFunctionBodies=false) at
/home/daniel/dev/llvm/tools/clang/lib/Parse/ParseAST.cpp:131
#38 0x00007ffff2abe311 in clang::ParseAST (PP=..., Consumer=0x1459820, Ctx=...,
PrintStats=false, TUKind=clang::TU_Complete, CompletionConsumer=0x0,
SkipFunctionBodies=false) at
/home/daniel/dev/llvm/tools/clang/lib/Parse/ParseAST.cpp:85
#39 0x00007ffff211b243 in lldb_private::ClangExpressionParser::Parse
(this=0x7fffffffad20, stream=...) at
/home/daniel/dev/llvm/tools/lldb/source/Expression/ClangExpressionParser.cpp:393
#40 0x00007ffff212842e in lldb_private::ClangUserExpression::Parse
(this=0x134bea0, error_stream=..., exe_ctx=...,
execution_policy=lldb_private::eExecutionPolicyOnlyWhenNeeded,
keep_result_in_memory=true) at
/home/daniel/dev/llvm/tools/lldb/source/Expression/ClangUserExpression.cpp:449
#41 0x00007ffff2129893 in lldb_private::ClangUserExpression::EvaluateWithError
(exe_ctx=..., execution_policy=lldb_private::eExecutionPolicyOnlyWhenNeeded,
language=lldb::eLanguageTypeUnknown,
desired_type=lldb_private::ClangExpression::eResultTypeAny,
unwind_on_error=true, ignore_breakpoints=true, 
    expr_cstr=0x10e20ab "str", expr_prefix=0x0, result_valobj_sp=...,
error=..., run_others=true, timeout_usec=0) at
/home/daniel/dev/llvm/tools/lldb/source/Expression/ClangUserExpression.cpp:862
#42 0x00007ffff2129678 in lldb_private::ClangUserExpression::Evaluate
(exe_ctx=..., execution_policy=lldb_private::eExecutionPolicyOnlyWhenNeeded,
language=lldb::eLanguageTypeUnknown,
desired_type=lldb_private::ClangExpression::eResultTypeAny,
unwind_on_error=true, ignore_breakpoints=true, expr_cstr=
    0x10e20ab "str", expr_prefix=0x0, result_valobj_sp=..., run_others=true,
timeout_usec=0) at
/home/daniel/dev/llvm/tools/lldb/source/Expression/ClangUserExpression.cpp:814
#43 0x00007ffff2400c7b in lldb_private::Target::EvaluateExpression
(this=0x113a8a0, expr_cstr=0x10e20ab "str", frame=0x7fffe004b500,
result_valobj_sp=..., options=...) at
/home/daniel/dev/llvm/tools/lldb/source/Target/Target.cpp:1828
#44 0x00007ffff1fa0168 in
lldb_private::CommandObjectExpression::EvaluateExpression (this=0xe36770,
expr=0x10e20ab "str", output_stream=0x10c48b0, error_stream=0x10c4918,
result=0x10c48b0) at
/home/daniel/dev/llvm/tools/lldb/source/Commands/CommandObjectExpression.cpp:347
#45 0x00007ffff1fa0c0f in lldb_private::CommandObjectExpression::DoExecute
(this=0xe36770, command=0x10e20a8 "-- str", result=...) at
/home/daniel/dev/llvm/tools/lldb/source/Commands/CommandObjectExpression.cpp:547
#46 0x00007ffff2183752 in lldb_private::CommandObjectRaw::Execute
(this=0xe36770, args_string=0x10e20a8 "-- str", result=...) at
/home/daniel/dev/llvm/tools/lldb/source/Interpreter/CommandObject.cpp:995
#47 0x00007ffff21784ce in lldb_private::CommandInterpreter::HandleCommand
(this=0xdf2230, command_line=0xd216b4 "print str",
lazy_add_to_history=lldb_private::eLazyBoolNo, result=...,
override_context=0x0, repeat_on_empty_command=true, no_context_switching=false)
    at
/home/daniel/dev/llvm/tools/lldb/source/Interpreter/CommandInterpreter.cpp:1760

A question was asked about this failure:
[http://permalink.gmane.org/gmane.comp.compilers.llvm.devel/59348](http://permalink.gmane.org/gmane.comp.compilers.llvm.devel/59348)

Daniel Malea changed bug 15256

What | Removed | Added |

  • | - | - |
    Status | NEW | RESOLVED |
    Resolution | — | FIXED |

Comment # 1 on bug 15256 from Daniel Malea

Workaround committed in trunk (r176140) thanks Greg!

Marking this PR as resolved, as the crash does does not reproduce in any of the
affected tests.