Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signal listener example code causes rustc LLVM compiler abort #13352

Closed
nathantypanski opened this issue Apr 6, 2014 · 1 comment
Closed

Comments

@nathantypanski
Copy link
Contributor

Updated report

This code trips an LLVM assertion:

fn foo(_: proc()) {}

fn main() {
    foo(loop {})
}
$ rustc foo.rs
Assertion failed: ((i >= FTy->getNumParams() || FTy->getParamType(i) == Args[i]->getType()) && "Calling a function with a bad signature!"), function init, file /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/llvm/lib/IR/Instructions.cpp, line 281.

Original report

Signal listener example code causes rustc LLVM compiler abort

In the 0.10 docs there is an example snippet for writing listeners. But if we wrap it in fn main() and try to run, rustc will crash and burn:

$ RUST_BACKTRACE=1 rustc procbad.rs
procbad.rs:6:5: 6:33 warning: unused result which must be used, #[warn(unused_must_use)] on by default
procbad.rs:6     listener.register(Interrupt);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
rustc: /home/nathan/devel/rust/rust/src/llvm/lib/IR/Instructions.cpp:549: 
void llvm::InvokeInst::init(llvm::Value*, llvm::BasicBlock*, llvm::BasicBlock*, llvm::ArrayRef<llvm::Value*>, const llvm::Twine&):
Assertion `(i >= FTy->getNumParams() || FTy->getParamType(i) ==
Args[i]->getType())
&& "Invoking a function with a bad signature!"' failed.
zsh: abort      RUST_BACKTRACE=1 rustc procbad.rs

Here is the code which you can copy-paste directly to reproduce this bug:

use std::io::signal::{Listener, Interrupt};

fn main() {
    let mut listener = Listener::new();
    listener.register(Interrupt);

    spawn({
        loop {
            match listener.rx.recv() {
                Interrupt => println!("Got Interrupt'ed"),
                _ => (),
            }
        }
    });
}

System information:

$ rustc -v
rustc 0.10 (46867cc 2014-04-02 16:59:39 -0700)
host: x86_64-unknown-linux-gnu
$ uname -a
Linux dionysus 3.13.0-rc8-dio-00005-ga6da83f #4 SMP PREEMPT Wed Feb 5 19:43:54 EST 2014 x86_64 GNU/Linux
$ cat /etc/issue
Debian GNU/Linux jessie/sid

Program version information used in compiling rustc:

configure: CFG_PERL             := /usr/bin/perl 
configure: CFG_CURLORWGET       := /usr/bin/curl (7.36.0)
configure: CFG_PYTHON           := /usr/bin/python2.7 
configure: CFG_GIT              := /usr/bin/git (1.9.1)
configure: CFG_CLANG            :=  
configure: CFG_CCACHE           := /usr/bin/ccache (3.1.9)
configure: CFG_GCC              := /home/nathan/bin/gcc (4.8.2-16)) [not custom; just a wrapper script for using ccache]
configure: CFG_LD               := /usr/bin/ld (2.24)
configure: CFG_VALGRIND         := /usr/bin/valgrind (3.9.0)
configure: CFG_PERF             := /usr/bin/perf (3.13.6)
configure: CFG_ISCC             :=  
configure: CFG_LLNEXTGEN        :=  
configure: CFG_PANDOC           := /home/nathan/.cabal/bin/pandoc (1.12.3.3)
configure: CFG_PDFLATEX         := /usr/bin/pdflatex (3.1415926-2.5-1.40.14)
configure: CFG_XELATEX          :=  
configure: CFG_LUALATEX         := /usr/bin/lualatex (0.76.0-2013070106)
configure: CFG_GDB              := /usr/bin/gdb (7.6.2)
configure: CFG_PAXCTL           :=  
configure: CFG_ZCAT             := /bin/zcat (1.6)
@alexcrichton
Copy link
Member

Updated with a shorter test case. Sadly the docs are marked as ignore so the example has fallen out of date.

alexcrichton added a commit to alexcrichton/rust that referenced this issue Apr 6, 2014
This also makes the listener struct sendable again by explicitly putting the
Send bound on the relevant Rtio object.

cc rust-lang#13352
bors added a commit that referenced this issue Apr 7, 2014
This also makes the listener struct sendable again by explicitly putting the
Send bound on the relevant Rtio object.

cc #13352
@bors bors closed this as completed in b9752b6 Jun 5, 2014
mcpherrinm pushed a commit to mcpherrinm/rust that referenced this issue Jun 10, 2014
matthiaskrgr pushed a commit to matthiaskrgr/rust that referenced this issue Oct 11, 2022
matthiaskrgr pushed a commit to matthiaskrgr/rust that referenced this issue Oct 11, 2022
bors added a commit to rust-lang-ci/rust that referenced this issue Sep 24, 2024
Correct version of `too_long_first_doc_paragraph`

`too_long_first_doc_paragraph` is, empirically, not in the Rust 1.81.0 release.

changelog: [`too_long_first_doc_paragraph`]: correct Rust version number in documentation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants