Skip to content

debuginfo/issue-22656.rs fails with LLVM/clang Assertion `Prior->FD->hasAttr<NoUniqueAddressAttr>() && "should not have reused this field's tail padding"' failed. #63784

Open
@eddyb

Description

@eddyb

I haven't been running debuginfo tests locally for a long while due to a variety of issues, but I was surprised to get only 1 failure, src/test/debuginfo/issue-22656.rs with LLDB:

python2.7: /home/eddy/Projects/rust-2/src/llvm-project/clang/lib/CodeGen/CGRecordLayoutBuilder.cpp:603:
  void (anonymous namespace)::CGRecordLowering::clipTailPadding():
  Assertion `Prior->FD->hasAttr<NoUniqueAddressAttr>() &&
    "should not have reused this field's tail padding"' failed.

If I had to guess, LLDB was trying to compile something as C++, and probably ran into something that's different in Rust (is it synthesizing C++ struct/union definitions from DWARF?).

cc @michaelwoerister

EDIT: this is the test, and, well, this looks like a regression?

// This test makes sure that the LLDB pretty printer does not throw an exception
// when trying to handle a Vec<> or anything else that contains zero-sized
// fields.
// min-lldb-version: 310
// ignore-gdb
// ignore-tidy-linelength
// compile-flags:-g
// === LLDB TESTS ==================================================================================
// lldb-command:run
// lldb-command:print v
// lldbg-check:[...]$0 = vec![1, 2, 3]
// lldbr-check:(alloc::vec::Vec<i32>) v = vec![1, 2, 3]
// lldb-command:print zs
// lldbg-check:[...]$1 = StructWithZeroSizedField { x: ZeroSizedStruct, y: 123, z: ZeroSizedStruct, w: 456 }
// lldbr-check:(issue_22656::StructWithZeroSizedField) zs = StructWithZeroSizedField { x: ZeroSizedStruct { }, y: 123, z: ZeroSizedStruct { }, w: 456 }
// lldbr-command:continue
#![allow(unused_variables)]
#![allow(dead_code)]
#![feature(omit_gdb_pretty_printer_section)]
#![omit_gdb_pretty_printer_section]
struct ZeroSizedStruct;
struct StructWithZeroSizedField {
x: ZeroSizedStruct,
y: u32,
z: ZeroSizedStruct,
w: u64
}
fn main() {
let v = vec![1,2,3];
let zs = StructWithZeroSizedField {
x: ZeroSizedStruct,
y: 123,
z: ZeroSizedStruct,
w: 456
};
zzz(); // #break
}
fn zzz() { () }

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)C-bugCategory: This is a bug.P-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions