Skip to content

SIGTRAP in drop glue when slice literal initialization panics #30018

Closed

Description

@sfackler
struct Foo;

impl Drop for Foo {
    fn drop(&mut self) {}
}

fn foo() -> Foo {
    panic!();
}

fn main() {
    let _ = &[foo()];
}

Backtrace:

* thread #1: tid = 0x9916e, 0x0000000100000deb test`Foo::drop.2547::ha10a92966c711a1c + 43, queue = 'com.apple.main-thread', stop reason = EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0)
  * frame #0: 0x0000000100000deb test`Foo::drop.2547::ha10a92966c711a1c + 43
    frame #1: 0x0000000100000da1 test`_$u5b$Foo$u3b$$u20$1$u5d$::drop.2545::h30bf5c7af770ce1a + 49
    frame #2: 0x0000000100000d6c test`main::h49ea8f6746b41e81Raa + 92
    frame #3: 0x0000000100006493 test`sys_common::unwind::try::try_fn::h8880715059644542985 + 35
    frame #4: 0x00000001000040a9 test`__rust_try + 9
    frame #5: 0x000000010000631c test`rt::lang_start::hf0f318bf9acb9103hUw + 540
    frame #6: 0x0000000100000e7a test`main + 42
    frame #7: 0x00007fff8e9185ad libdyld.dylib`start + 1

Activity

  1. added
    I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.
    on Nov 24, 2015
  2. sfackler commented on Nov 24, 2015

    @sfackler
    MemberAuthor

    Popped up in broken tests in one of my crates: kornelski/rust-security-framework@8ab48c2

  3. alexcrichton commented on Nov 25, 2015

    @alexcrichton
    Member

    triage: I-nominated

    probably good to have crashes like this categorized at least

  4. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    and removed on Nov 25, 2015
  5. sfackler commented on Nov 25, 2015

    @sfackler
    MemberAuthor

    It does appear to have been present since 1.0 at least, BTW.

  6. sfackler commented on Nov 25, 2015

    @sfackler
    MemberAuthor

    @alexcrichton added back I-nominated, assuming that the removal was unintentional.

  7. nikomatsakis commented on Dec 3, 2015

    @nikomatsakis
    Contributor

    @pnkfelix notes that this is likely a debug flag, and probably only occurs if debug assertions are enabled.

  8. nikomatsakis commented on Dec 3, 2015

    @nikomatsakis
    Contributor

    triage: P-medium

  9. sfackler commented on Dec 3, 2015

    @sfackler
    MemberAuthor

    Yeah, when compiling with optimizations, it won't hit this signal but continues on and behavior depends on the specific case. The minimized example exits without issue, but the test case I had in my crate segfaults.

  10. self-assigned this
    on Jan 11, 2016
  11. pnkfelix commented on Jan 11, 2016

    @pnkfelix
    Contributor

    I think I know why this happens; it is probably related to how somewhat sloppy handling of the drop flags on scratch/temporary values in other contexts (see e.g. #30530).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

I-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.P-mediumMedium 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