Skip to content

Missing line information for calls to diverging functions #59558

@ghost

Description

Under some circumstances, rustc emits debug information with missing line numbers for calls to diverging functions.

fn main() {
    if True == False {
        // unreachable
        diverge();
    }

    diverge();
}

#[derive(PartialEq)]
pub enum MyBool {
    True,
    False,
}

use MyBool::*;

fn diverge() -> ! {
    panic!();
}

Compiling with rustc main.rs -g --emit=llvm-ir -Clto and then inspecting the debug info for main in the .ll file, the line information is 0:

call void @_ZN4main7diverge17h595c254fa559ce50E(), !dbg !3943
!3943 = !DILocation(line: 0, scope: !3942)

If the unreachable call is removed, the line info matches the source file as expected:

!4340 = !DILocation(line: 16, column: 4, scope: !4338)

I get the same behavior with the latest stable

rustc 1.33.0 (2aa4c46cf 2019-02-28)
binary: rustc
commit-hash: 2aa4c46cfdd726e97360c2734835aa3515e8c858
commit-date: 2019-02-28
host: x86_64-unknown-linux-gnu
release: 1.33.0
LLVM version: 8.0

and with the latest nightly

rustc 1.35.0-nightly (237bf3244 2019-03-28)
binary: rustc
commit-hash: 237bf3244fffef501cf37d4bda00e1fce3fcfb46
commit-date: 2019-03-28
host: x86_64-unknown-linux-gnu
release: 1.35.0-nightly
LLVM version: 8.0

cc @japaric

Metadata

Metadata

Assignees

Labels

A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.T-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