Skip to content

ret guard makes the LLVM verifier sad #958

@jruderman

Description

@jruderman
fn main() {
    alt 2 {
      x when (ret) { x; }
    }
}

LLVM dies saying:

PHINode should have one entry for each predecessor of its parent basic block!
  %6 = phi i32* [ %3, %9 ]
Broken module found, compilation aborted!
Stack dump:
0.      Running pass 'Function Pass Manager' on module 'rust_out'.
1.      Running pass 'Module Verifier' on function '@_ZN4main17_58aa485ede601b15E'

with the stack:

0   librustllvm.dylib               0x0161ca67 abort + 39
1   librustllvm.dylib               0x015b8563 (anonymous namespace)::Verifier::abortIfBroken() + 211
2   librustllvm.dylib               0x015c9fc7 (anonymous namespace)::Verifier::runOnFunction(llvm::Function&) + 1927
3   librustllvm.dylib               0x01599f1f llvm::FPPassManager::runOnFunction(llvm::Function&) + 655
4   librustllvm.dylib               0x0159a02c llvm::FPPassManager::runOnModule(llvm::Module&) + 156
5   librustllvm.dylib               0x0159986f llvm::MPPassManager::runOnModule(llvm::Module&) + 639
6   librustllvm.dylib               0x01599b4c llvm::PassManagerImpl::run(llvm::Module&) + 172
7   librustllvm.dylib               0x01599c8b llvm::PassManager::run(llvm::Module&) + 27
8   librustllvm.dylib               0x009fc5a0 LLVMRustWriteOutputFile + 768 (RustWrapper.cpp:96)
9   rustc                           0x00009007 _ZN3lib4llvm4llvmE681 + 119
10  rustc                           0x00632a86 back::link::write::run_passes::anon7290::anon7291 + 150
11  libstd.dylib                    0x00908cc6 str::as_buf + 294
12  rustc                           0x006329cb back::link::write::run_passes::anon7290 + 187
13  libstd.dylib                    0x00908cc6 str::as_buf + 294
14  rustc                           0x004e3d77 back::link::write::run_passes + 14391
15  rustc                           0x0064106e driver::rustc::compile_input::thunk8003 + 158
16  rustc                           0x00557ea0 driver::rustc::time + 352
17  rustc                           0x0055f3c7 driver::rustc::compile_input + 23431
18  rustc                           0x0057ddb8 driver::rustc::main + 45960
19  rustc                           0x0057f90f _rust_main + 63
20  rustc                           0x00645b1f _rust_main_wrap + 31
21  librustrt.dylib                 0x0088af4c task_start_wrapper + 60 (rust_task.cpp:149)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions