Skip to content

-Zvirtual-function-elimination miscompiles simple hello world program if other optimizations are turned onΒ #98132

Open
@matthiaskrgr

Description

@matthiaskrgr
cargo new foo
cd foo
rustc  -Clto  -Cembed-bitcode=yes -Zvirtual-function-elimination src/main.rs 
./main # this works
> Hello, world!
rustc  -Clto  -Cembed-bitcode=yes -Zvirtual-function-elimination src/main.rs -Copt-level=1
./main
> [1]    2203089 segmentation fault (core dumped)  ./main

cc #96285

rustc 1.63.0-nightly (389352c4b 2022-06-15)
binary: rustc
commit-hash: 389352c4bbd56024eefd1566e06dcba04d223f92
commit-date: 2022-06-15
host: x86_64-unknown-linux-gnu
release: 1.63.0-nightly
LLVM version: 14.0.5

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-crashIssue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics.I-miscompileIssue: Correct Rust code lowers to incorrect machine codeI-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.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions