Skip to content

Optimizer fails to remove instructions after abort #143127

Closed
@SUPERCILEX

Description

@SUPERCILEX

I tried this code:

pub fn foo(_v: Vec<u8>) {
    std::process::abort()
}

Godbolt shows unwinding after the ud2 instructions which doesn't make sense:

example::foo::head1d7ed7dbf2287:
        push    r14
        push    rbx
        push    rax
        mov     r14, rdi
        call    qword ptr [rip + std::process::abort::h3e94a41c09fe797f@GOTPCREL]
        ud2
        mov     rbx, rax
        mov     rsi, qword ptr [r14]
        test    rsi, rsi
        je      .LBB0_4
        mov     rdi, qword ptr [r14 + 8]
        mov     edx, 1
        call    qword ptr [rip + __rustc[e054f922969c5460]::__rust_dealloc@GOTPCREL]
.LBB0_4:
        mov     rdi, rbx
        call    _Unwind_Resume@PLT

DW.ref.rust_eh_personality:
        .quad   rust_eh_personality

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-discussionCategory: Discussion or questions that doesn't represent real issues.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions