Skip to content

Infinite recursion can be "optimized" into LLVM undef which produces a garbage value #18785

@nodakai

Description

@nodakai
fn f(x: i32) -> i32 {
    f(x)
}

fn main() {
    println!("{}", f(0));
}
0
Program ended.

Note we get a stack overflow as expected(!?) with -O0 (observation by mboeh)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.I-unsoundIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessT-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