You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With the following RUSTFLAGS=" -C link-dead-code -C debuginfo=2 --cfg=tarpaulin -Z instrument-coverage " and nightly-x86_64-pc-windows-msvc unchanged - rustc 1.56.0-nightly (4927238 2021-07-29) and this test:
//lib.rspubmod unused;pubfnbranch_test_one(x:i32) -> i32{if x > 5{10}else{5}}#[cfg(test)]mod tests {use branch_test_one;#[test]fnbad_test(){branch_test_one(2);}}
unused.rs contains just a single function that's never used:
//unused.rspubfnhello(){println!("Hello world");println!("I'm never tested");}
I expected to see to see it exit fine and the profraw file generated and the test exit successfully. Instead an empty profraw file is generated and the test segfaults. I don't know if this is connected to #77553@richkadel
The text was updated successfully, but these errors were encountered:
This this is a known bug with link-dead-code implementation on msvc, not instrument-coverage. I implemented a different way to support dead code coverage (enabled by default) because I could never figure out why link-dead-code always caused the binary to segfault. The profraw file is empty because the binary segfaults before it has an opportunity to write the file on exit.
Can you do me a favor and retitle this issue to relate it to the link-dead-code option instead?
xd009642
changed the title
Test compiled with -Z instrument-coverage segfaults on windows
Link-dead-code and -Z instrument-coverage causes segfault and no coverage on Windows
Jul 31, 2021
With the following
RUSTFLAGS=" -C link-dead-code -C debuginfo=2 --cfg=tarpaulin -Z instrument-coverage "
and nightly-x86_64-pc-windows-msvc unchanged - rustc 1.56.0-nightly (4927238 2021-07-29) and this test:unused.rs contains just a single function that's never used:
I expected to see to see it exit fine and the profraw file generated and the test exit successfully. Instead an empty profraw file is generated and the test segfaults. I don't know if this is connected to #77553 @richkadel
The text was updated successfully, but these errors were encountered: