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

Release build fails with SIGSEGV #20

Closed
svend opened this issue Sep 30, 2016 · 6 comments
Closed

Release build fails with SIGSEGV #20

svend opened this issue Sep 30, 2016 · 6 comments

Comments

@svend
Copy link

svend commented Sep 30, 2016

When building with the cargo build --release, the build fails with (signal: 11, SIGSEGV: Invalid memory reference). Building with cargo build (no --release flag) works. Here is the full output, along with the rust version:

ubuntu@host:~/syn$ git describe
0.8.0
ubuntu@host:~/syn$ cargo build --release --verbose
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling quote v0.2.0
     Running `rustc /home/ubuntu/.cargo/registry/src/github.mirror.nvdadr.com-1ecc6299db9ec823/quote-0.2.0/src/lib.rs --crate-name quote --crate-type lib -C opt-level=3 -C metadata=9442466506b24325 -C extra-filename=-9442466506b24325 --out-dir /home/ubuntu/syn/target/release/deps --emit=dep-info,link -L dependency=/home/ubuntu/syn/target/release/deps --cap-lints allow`
   Compiling syn v0.8.0 (file:///home/ubuntu/syn)
     Running `rustc src/lib.rs --crate-name syn --crate-type lib -C opt-level=3 --cfg feature=\"default\" --cfg feature=\"printing\" --cfg feature=\"parsing\" --cfg feature=\"quote\" -C metadata=977935f812d0e598 --out-dir /home/ubuntu/syn/target/release/deps --emit=dep-info,link -L dependency=/home/ubuntu/syn/target/release/deps --extern quote=/home/ubuntu/syn/target/release/deps/libquote-9442466506b24325.rlib`
error: Could not compile `syn`.

Caused by:
  Process didn't exit successfully: `rustc src/lib.rs --crate-name syn --crate-type lib -C opt-level=3 --cfg feature="default" --cfg feature="printing" --cfg feature="parsing" --cfg feature="quote" -C metadata=977935f812d0e598 --out-dir /home/ubuntu/syn/target/release/deps --emit=dep-info,link -L dependency=/home/ubuntu/syn/target/release/deps --extern quote=/home/ubuntu/syn/target/release/deps/libquote-9442466506b24325.rlib` (signal: 11, SIGSEGV: Invalid memory reference)
ubuntu@host:~/syn$ rustc --version --verbose
rustc 1.12.0 (3191fbae9 2016-09-23)
binary: rustc
commit-hash: 3191fbae9da539442351f883bdabcad0d72efcb6
commit-date: 2016-09-23
host: x86_64-unknown-linux-gnu
release: 1.12.0
@svend
Copy link
Author

svend commented Sep 30, 2016

Building with rust 1.11.0 works. Let me know if I should file an issue with rust.

ubuntu@host:~/syn$ rustc --version --verbose
rustc 1.11.0 (9b21dcd6a 2016-08-15)
binary: rustc
commit-hash: 9b21dcd6a89f38e8ceccb2ede8c9027cb409f6e3
commit-date: 2016-08-15
host: x86_64-unknown-linux-gnu
release: 1.11.0
ubuntu@host:~/syn$ cargo build --release --verbose
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Compiling quote v0.2.0
     Running `rustc /home/ubuntu/.cargo/registry/src/github.mirror.nvdadr.com-1ecc6299db9ec823/quote-0.2.0/src/lib.rs --crate-name quote --crate-type lib -C opt-level=3 -C metadata=9442466506b24325 -C extra-filename=-9442466506b24325 --out-dir /home/ubuntu/syn/target/release/deps --emit=dep-info,link -L dependency=/home/ubuntu/syn/target/release/deps -L dependency=/home/ubuntu/syn/target/release/deps --cap-lints allow`
   Compiling syn v0.8.0 (file:///home/ubuntu/syn)
     Running `rustc src/lib.rs --crate-name syn --crate-type lib -C opt-level=3 --cfg feature=\"quote\" --cfg feature=\"default\" --cfg feature=\"printing\" --cfg feature=\"parsing\" --out-dir /home/ubuntu/syn/target/release --emit=dep-info,link -L dependency=/home/ubuntu/syn/target/release -L dependency=/home/ubuntu/syn/target/release/deps --extern quote=/home/ubuntu/syn/target/release/deps/libquote-9442466506b24325.rlib`

@dtolnay
Copy link
Owner

dtolnay commented Sep 30, 2016

Definitely a compiler bug.

It goes away with this commit 3a2ea4b so I have a lead.

@svend
Copy link
Author

svend commented Sep 30, 2016

@dtolnay Thanks. I filed an issue before I read your response. It is here: rust-lang/rust#36875

@dtolnay
Copy link
Owner

dtolnay commented Sep 30, 2016

Narrowed down further: e8b4e20.

@dtolnay
Copy link
Owner

dtolnay commented Sep 30, 2016

I can't work on this right now but I will do my best to release a workaround later tonight.

@dtolnay
Copy link
Owner

dtolnay commented Oct 1, 2016

I released a workaround in 0.8.1.

The following code triggered the bug:

pub fn str_chars(s: &str) -> Vec<char> {
    s.chars().collect()
}

The following workaround avoided the bug:

pub fn str_chars(s: &str) -> Vec<char> {
    let mut result = Vec::new();
    for ch in s.chars() {
        result.push(ch);
    }
    result
}

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