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

Regression in rust nightly 2017-03-04 #40493

Closed
Drakulix opened this issue Mar 13, 2017 · 8 comments
Closed

Regression in rust nightly 2017-03-04 #40493

Drakulix opened this issue Mar 13, 2017 · 8 comments
Assignees
Labels
P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@Drakulix
Copy link

I cannot compile my library wlc (on crates.io) on nightlies later then 2017-03-03 anymore.
The code is not using any unstable features, if compiled with the feature "unsafe-stable" and results do not differ between "default" features (which uses optin_builtin_traits) and the "unsafe-stable" feature (which does disable optin_builtin_traits).

So code, that still works on stable and beta, does not compile anymore without any helpful error messages (see below).

Overview:

Working:

rustup run stable cargo build --features "unsafe-stable"
rustup run beta cargo build --features "unsafe-stable"
rustup run nightly-2017-03-03 cargo build --features "unsafe-stable"

Broken:

rustup run nightly-2017-03-04 cargo build --features "unsafe-stable"
rustup run nightly-2017-03-04 cargo build

Both abort with a stack overflow:

 Compiling wlc v2.0.1 (file:///home/drakulix/Projects/tavern/wlc)
     Running `rustc --crate-name wlc src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="unsafe-stable"' -C metadata=16cc333f6e306687 -C extra-filename=-16cc333f6e306687 --out-dir /home/drakulix/Projects/tavern/wlc/target/debug/deps -L dependency=/home/drakulix/Projects/tavern/wlc/target/debug/deps --extern libc=/home/drakulix/Projects/tavern/wlc/target/debug/deps/liblibc-2a4507ee5e52ea3e.rlib --extern wlc_sys=/home/drakulix/Projects/tavern/wlc/target/debug/deps/libwlc_sys-03e3fe15a0f6e02b.rlib --extern uinput_sys=/home/drakulix/Projects/tavern/wlc/target/debug/deps/libuinput_sys-1e8aa47014f4e364.rlib --extern lazy_static=/home/drakulix/Projects/tavern/wlc/target/debug/deps/liblazy_static-2a16fcec40d2bdf3.rlib --extern num_traits=/home/drakulix/Projects/tavern/wlc/target/debug/deps/libnum_traits-51f88ce8f32c0283.rlib --extern bitflags=/home/drakulix/Projects/tavern/wlc/target/debug/deps/libbitflags-88857433f6b67df9.rlib --extern log=/home/drakulix/Projects/tavern/wlc/target/debug/deps/liblog-2f7366be74992849.rlib --extern xkbcommon=/home/drakulix/Projects/tavern/wlc/target/debug/deps/libxkbcommon-ff825cd69a6d510f.rlib`

thread 'rustc' has overflowed its stack
fatal runtime error: stack overflow
error: Could not compile `wlc`.

Caused by:
  process didn't exit successfully: `rustc --crate-name wlc src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 --cfg feature="default" --cfg feature="unsafe-stable" -C metadata=16cc333f6e306687 -C extra-filename=-16cc333f6e306687 --out-dir /home/drakulix/Projects/tavern/wlc/target/debug/deps -L dependency=/home/drakulix/Projects/tavern/wlc/target/debug/deps --extern libc=/home/drakulix/Projects/tavern/wlc/target/debug/deps/liblibc-2a4507ee5e52ea3e.rlib --extern wlc_sys=/home/drakulix/Projects/tavern/wlc/target/debug/deps/libwlc_sys-03e3fe15a0f6e02b.rlib --extern uinput_sys=/home/drakulix/Projects/tavern/wlc/target/debug/deps/libuinput_sys-1e8aa47014f4e364.rlib --extern lazy_static=/home/drakulix/Projects/tavern/wlc/target/debug/deps/liblazy_static-2a16fcec40d2bdf3.rlib --extern num_traits=/home/drakulix/Projects/tavern/wlc/target/debug/deps/libnum_traits-51f88ce8f32c0283.rlib --extern bitflags=/home/drakulix/Projects/tavern/wlc/target/debug/deps/libbitflags-88857433f6b67df9.rlib --extern log=/home/drakulix/Projects/tavern/wlc/target/debug/deps/liblog-2f7366be74992849.rlib --extern xkbcommon=/home/drakulix/Projects/tavern/wlc/target/debug/deps/libxkbcommon-ff825cd69a6d510f.rlib` (exit code: 1)

rustup run nightly-2017-03-12 cargo build --features "unsafe-stable"
rustup run nightly-2017-03-12 cargo build

Both fail without any specific error:

Compiling wlc v2.0.1 (file:///home/drakulix/Projects/tavern/wlc)
     Running `rustc --crate-name wlc src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 --cfg 'feature="unsafe-stable"' --cfg 'feature="default"' -C metadata=16cc333f6e306687 -C extra-filename=-16cc333f6e306687 --out-dir /home/drakulix/Projects/tavern/wlc/target/debug/deps -L dependency=/home/drakulix/Projects/tavern/wlc/target/debug/deps --extern wlc_sys=/home/drakulix/Projects/tavern/wlc/target/debug/deps/libwlc_sys-03e3fe15a0f6e02b.rlib --extern uinput_sys=/home/drakulix/Projects/tavern/wlc/target/debug/deps/libuinput_sys-1e8aa47014f4e364.rlib --extern xkbcommon=/home/drakulix/Projects/tavern/wlc/target/debug/deps/libxkbcommon-ff825cd69a6d510f.rlib --extern libc=/home/drakulix/Projects/tavern/wlc/target/debug/deps/liblibc-2a4507ee5e52ea3e.rlib --extern bitflags=/home/drakulix/Projects/tavern/wlc/target/debug/deps/libbitflags-88857433f6b67df9.rlib --extern num_traits=/home/drakulix/Projects/tavern/wlc/target/debug/deps/libnum_traits-51f88ce8f32c0283.rlib --extern lazy_static=/home/drakulix/Projects/tavern/wlc/target/debug/deps/liblazy_static-2a16fcec40d2bdf3.rlib --extern log=/home/drakulix/Projects/tavern/wlc/target/debug/deps/liblog-2f7366be74992849.rlib`
error: Could not compile `wlc`.

Caused by:
  process didn't exit successfully: `rustc --crate-name wlc src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 --cfg feature="unsafe-stable" --cfg feature="default" -C metadata=16cc333f6e306687 -C extra-filename=-16cc333f6e306687 --out-dir /home/drakulix/Projects/tavern/wlc/target/debug/deps -L dependency=/home/drakulix/Projects/tavern/wlc/target/debug/deps --extern wlc_sys=/home/drakulix/Projects/tavern/wlc/target/debug/deps/libwlc_sys-03e3fe15a0f6e02b.rlib --extern uinput_sys=/home/drakulix/Projects/tavern/wlc/target/debug/deps/libuinput_sys-1e8aa47014f4e364.rlib --extern xkbcommon=/home/drakulix/Projects/tavern/wlc/target/debug/deps/libxkbcommon-ff825cd69a6d510f.rlib --extern libc=/home/drakulix/Projects/tavern/wlc/target/debug/deps/liblibc-2a4507ee5e52ea3e.rlib --extern bitflags=/home/drakulix/Projects/tavern/wlc/target/debug/deps/libbitflags-88857433f6b67df9.rlib --extern num_traits=/home/drakulix/Projects/tavern/wlc/target/debug/deps/libnum_traits-51f88ce8f32c0283.rlib --extern lazy_static=/home/drakulix/Projects/tavern/wlc/target/debug/deps/liblazy_static-2a16fcec40d2bdf3.rlib --extern log=/home/drakulix/Projects/tavern/wlc/target/debug/deps/liblog-2f7366be74992849.rlib` (exit code: 1)

I have no idea, where I should start to debug this. Reproducing this error is also quite annoying to setup, as the library depends on a bunch of native libraries not available in most repositories. So I am thankful for any hints about how I could provide more information.

All tests where done after running cargo clean.

Meta

rustc --version --verbose:

rustc 1.17.0-nightly (824c9ebbd 2017-03-12)
binary: rustc
commit-hash: 824c9ebbd5f0611e326648d90ee3e50caf04bb7f
commit-date: 2017-03-12
host: x86_64-unknown-linux-gnu
release: 1.17.0-nightly
LLVM version: 3.9
@arielb1 arielb1 added regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. regression-from-stable-to-beta Performance or correctness regression from stable to beta. and removed regression-from-stable-to-nightly Performance or correctness regression from stable to nightly. labels Mar 14, 2017
@arielb1
Copy link
Contributor

arielb1 commented Mar 16, 2017

1.17 is now beta

@arielb1 arielb1 added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Mar 16, 2017
@nikomatsakis
Copy link
Contributor

nikomatsakis commented Mar 16, 2017

Probably a duplicate of #40573 -- stack usage jumped up for some reason

@nikomatsakis
Copy link
Contributor

triage: P-high

@rust-highfive rust-highfive added the P-high High priority label Mar 16, 2017
@Drakulix
Copy link
Author

The RUST_MIN_STACK workaround discussed in #40573 works for this as well. So I assume this is a indeed a duplicate of #40573.

arielb1 added a commit to arielb1/rust that referenced this issue Apr 2, 2017
LLVM has a bug - PR32488 - where it fails to deduplicate allocas in some
circumstances. The function `start_new_block` has allocas totalling 1216
bytes, and when LLVM inlines several copies of that function into
the recursive function `expr::into`, that function's stack space usage
goes into tens of kiBs, causing stack overflows.

Mark `start_new_block` as inline(never) to keep it from being inlined,
getting stack usage under control.

Fixes rust-lang#40493.
Fixes rust-lang#40573.
arielb1 added a commit to arielb1/rust that referenced this issue Apr 2, 2017
LLVM has a bug - PR32488 - where it fails to deduplicate allocas in some
circumstances. The function `start_new_block` has allocas totalling 1216
bytes, and when LLVM inlines several copies of that function into
the recursive function `expr::into`, that function's stack space usage
goes into tens of kiBs, causing stack overflows.

Mark `start_new_block` as inline(never) to keep it from being inlined,
getting stack usage under control.

Fixes rust-lang#40493.
Fixes rust-lang#40573.
@brson
Copy link
Contributor

brson commented Apr 4, 2017

Fixes are enqueued. Need confirmation from op yet.

@Drakulix
Copy link
Author

Drakulix commented Apr 4, 2017

@brson Trying to get this patched branch build and tested right now. I will report back asap.

@Drakulix
Copy link
Author

Drakulix commented Apr 4, 2017

arielb1:new-block-stack does indeed fix the issue!

@arielb1
Copy link
Contributor

arielb1 commented Apr 4, 2017

Excellent.

arielb1 pushed a commit to arielb1/rust that referenced this issue Apr 5, 2017
…hton

mark build::cfg::start_new_block as inline(never)

LLVM has a bug - [PR32488](https://bugs.llvm.org//show_bug.cgi?id=32488) - where it fails to deduplicate allocas in some
circumstances. The function `start_new_block` has allocas totalling 1216
bytes, and when LLVM inlines several copies of that function into
the recursive function `expr::into`, that function's stack space usage
goes into tens of kiBs, causing stack overflows.

Mark `start_new_block` as inline(never) to keep it from being inlined,
getting stack usage under control.

Fixes rust-lang#40493.
Fixes rust-lang#40573.

r? @eddyb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants