Skip to content

LLDB crashes evaluating a no_unique_address structure with tail padding #148838

Open
@labath

Description

@labath

(Note you need to have assertions enabled for this to crash. With assertions disabled this seems to work, but presumably the assertion is there for a reason.)

$ cat a.cc
struct NoAddr {
private:
  int large_member;
  char small_member;
};

struct Padder {
  [[no_unique_address]] NoAddr no_addr;
  char member_in_padding;
};

Padder *padder;
$ clang++ a.cc -c -g -o a.o -fstandalone-debug
$ lldb a.o -o "expr -- *padder"
(lldb) target create "a.o"
Current executable set to '/tmp/a.o' (x86_64).
(lldb) expr -- *padder
lldb: clang/lib/CodeGen/CGRecordLayoutBuilder.cpp:960: void {anonymous}::CGRecordLow
ering::checkBitfieldClipping(bool) const: Assertion `M.Offset >= Tail && "Bitfield access unit is not clipped"' failed.
LLDB diagnostics will be written to /tmp/diagnostics-ef7e28
Please include the directory content when filing a bug report
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrac
e.
Stack dump:
0.	Program arguments: lldb a.o -o "expr -- *padder"
 #0 0x00005625ccf52ad0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (lldb+0x65ad0)
 #1 0x00005625ccf500da SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x00007f2324e4ac50 (/lib64/libc.so.6+0x3cc50)
 #3 0x00007f2324f2024d syscall (/lib64/libc.so.6+0x11224d)
 #4 0x00007f2329fcf3e2 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #5 0x00007f2324e4ac50 (/lib64/libc.so.6+0x3cc50)
 #6 0x00007f2324ea11bc (/lib64/libc.so.6+0x931bc)
 #7 0x00007f2324e4aba6 raise (/lib64/libc.so.6+0x3cba6)
 #8 0x00007f2324e328fa abort (/lib64/libc.so.6+0x248fa)
 #9 0x00007f2324e3281e (/lib64/libc.so.6+0x2481e)
#10 0x00007f2324e42f16 (/lib64/libc.so.6+0x34f16)
#11 0x00007f232bc869bc (anonymous namespace)::CGRecordLowering::lower(bool) CGRecordLayoutBuilder.cpp:0:0
#12 0x00007f232bc86ef5 clang::CodeGen::CodeGenTypes::ComputeRecordLayout(clang::RecordDecl const*, llvm::
StructType*) CGRecordLayoutBuilder.cpp:0:0
#13 0x00007f232bc78e7f clang::CodeGen::CodeGenTypes::ConvertRecordDeclType(clang::RecordDecl const*) Code
GenTypes.cpp:0:0
#14 0x00007f232bc7c575 clang::CodeGen::CodeGenTypes::ConvertTypeForMem(clang::QualType) CodeGenTypes.cpp:
0:0
#15 0x00007f232bc9f89a EmitPointerWithAlignment(clang::Expr const*, clang::CodeGen::LValueBaseInfo*, clan
g::CodeGen::TBAAAccessInfo*, clang::CodeGen::KnownNonNull_t, clang::CodeGen::CodeGenFunction&) CGExpr.cpp
:0:0
...

A possible fix in #122197.

Metadata

Metadata

Assignees

No one assigned

    Labels

    clang:codegenIR generation bugs: mangling, exceptions, etc.lldb

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions