Description
This is occurring on X86-64 Linux with LLVM commit f104d64 (tip of tree at the time of writing) with an assertions (LLVM_ENABLE_ASSERTIONS=ON
) build with CMAKE_BUILD_TYPE
set to RelWithDebInfo
.
When debugging one of the LLVM programs (llvm-exegesis
) with lldb (everything compiled with assertions enabled), printing pointers (maybe some? maybe all?) causes an assertion in clipTailPadding()
. The following is what I get on my machine/setup:
lldb llvm-exegesis -- -mode=latency --use-dummy-perf-counters -opcode-name=ADD64rr
Within lldb
:
(lldb) b BenchmarkRunner.cpp:104
Breakpoint 1: where = llvm-exegesis`void llvm::function_ref<void ()>::callback_fn<llvm::exegesis::(anonymous namespace)::FunctionExecutorImpl::runWithCounter(llvm::StringRef) const::'lambda'()>(long) + 10 [inlined] llvm::exegesis::(anonymous namespace)::FunctionExecutorImpl::runWithCounter(llvm::StringRef) const::'lambda'()::operator()() const at BenchmarkRunner.cpp:104:9, address = 0x0000000004f60d4a
(lldb) run
rocess 1540 launched: '/llvm-project/build/bin/llvm-exegesis' (x86_64)
Process 1540 stopped
* thread #1, name = 'llvm-exegesis', stop reason = breakpoint 1.1
frame #0: 0x0000561426db3d4a llvm-exegesis`void llvm::function_ref<void ()>::callback_fn<llvm::exegesis::(anonymous namespace)::FunctionExecutorImpl::runWithCounter(llvm::StringRef) const::'lambda'()>(long) [inlined] llvm::exegesis::(anonymous namespace)::FunctionExecutorImpl::runWithCounter(this=0x00007ffd2b121298) const::'lambda'()::operator()() const at BenchmarkRunner.cpp:104:9
101 CrashRecoveryContext CRC;
102 CrashRecoveryContext::Enable();
103 const bool Crashed = !CRC.RunSafely([this, Counter, ScratchPtr]() {
-> 104 Counter->start();
105 this->Function(ScratchPtr);
106 Counter->stop();
107 });
(lldb) p Counter
lldb: /llvm-project/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp:753: void (anonymous namespace)::CGRecordLowering::clipTailPadding(): Assertion `Prior->Kind == MemberInfo::Field && "Only storage fields have tail padding!"' failed.
LLDB diagnostics will be written to /tmp/diagnostics-22bb98
Please include the directory content when filing a bug report
Aborted (core dumped)
This also occurs if I try and print ScratchPtr
which is of type char *const
. This behavior doesn't occur when I use a release build of lldb
with assertions disabled (same invocation):
(lldb) b BenchmarkRunner.cpp:104
Breakpoint 1: where = llvm-exegesis`void llvm::function_ref<void ()>::callback_fn<llvm::exegesis::(anonymous namespace)::FunctionExecutorImpl::runWithCounter(llvm::StringRef) const::'lambda'()>(long) + 10 [inlined] llvm::exegesis::(anonymous namespace)::FunctionExecutorImpl::runWithCounter(llvm::StringRef) const::'lambda'()::operator()() const at BenchmarkRunner.cpp:104:9, address = 0x0000000004f60d4a
(lldb) run
Process 8962 launched: '/llvm-project/build/bin/llvm-exegesis' (x86_64)
Process 8962 stopped
* thread #1, name = 'llvm-exegesis', stop reason = breakpoint 1.1
frame #0: 0x0000562848cded4a llvm-exegesis`void llvm::function_ref<void ()>::callback_fn<llvm::exegesis::(anonymous namespace)::FunctionExecutorImpl::runWithCounter(llvm::StringRef) const::'lambda'()>(long) [inlined] llvm::exegesis::(anonymous namespace)::FunctionExecutorImpl::runWithCounter(this=0x00007ffc41e04308) const::'lambda'()::operator()() const at BenchmarkRunner.cpp:104:9
101 CrashRecoveryContext CRC;
102 CrashRecoveryContext::Enable();
103 const bool Crashed = !CRC.RunSafely([this, Counter, ScratchPtr]() {
-> 104 Counter->start();
105 this->Function(ScratchPtr);
106 Counter->stop();
107 });
(lldb) p Counter
(llvm::exegesis::pfm::Counter *) 0x000056284b453370
(lldb) p ScratchPtr
(char *const) 0x00007f273fa57400 ""
So it seems like the assertion might not be correct, but more investigation is necessary. I realize that this probably isn't a particularly helpful/actionable bug report since there's no MRE and I haven't been able to generalize anything yet. Hoping to get a MRE up soon (assuming I can get one) and better understand the behavior. Just wanted to get the documentation of this started so I have a place to put things.