Xudong-Huang / generator-rs

rust stackful generator library
Apache License 2.0
286 stars 35 forks source link

`test_inner_ref` test fail when compiling v0.6.21 (current master) in debug mode when used in a workspace #23

Closed robinmoussu closed 3 years ago

robinmoussu commented 3 years ago

When running cargo test I get the following error

  process didn't exit successfully: `$HOME/$WORSKSPACE/target/debug/deps/lib-2737ca9cdad51a01` (signal: 11, SIGSEGV: invalid memory reference)

I can't reproduce it I just clone the project in a standalone directory. However if I clone it in my workspace, and only in debug mode, the test test_inner_ref fails with the above error. I tried to rebuild (cargo clean + cargo build) and still got the error. Given that this test uses unsafe code, I think that some assumption about alignment are wrong.

robinmoussu commented 3 years ago

I noticed that when I use the following test profile, I have other tests of my workspace that fails (they all use indirectly the generator crate), so I fear that the root cause is worse than what I was expecting:

[profile.test]
opt-level = 3
lto=true

To double check that is was really an issue with the generator crate, I replace the local clone of generator-rs from the workspace with a dependency to genarator = 0.6.21 in the respective Cargo.toml, kept the above profile. All tests are became green.

Xudong-Huang commented 3 years ago

Thanks for the reporting. What's the rust version you are using? Nightly or stable? What's the OS you are using?

robinmoussu commented 3 years ago

I'm using fedora 30, and installed the Rust toolchain using rustup.

So it's an issue with the nightly channel. Do you know when I should report this?

Xudong-Huang commented 3 years ago

It should work with every stable rust version. But for the nightly only latest compiler should be used. I have to adjust the asm code to make it work with the latest nightly compiler from time to time. So this is not an issue.

Xudong-Huang commented 3 years ago

I changed nightly to use the stable asm branch, it's no longer depend on the nightly asm feature.