Skip to content

SIGILL when compiling cc with -C instrument-coverage -Z coverage-options=mcdc #140677

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

Open
esarver opened this issue May 5, 2025 · 5 comments
Open
Labels
A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example requires-nightly This issue requires a nightly compiler in some way. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@esarver
Copy link

esarver commented May 5, 2025

As part of my project, I tried to compile cc (1.1.16) with -C instrument-coverage (enabled using cargo-llvm-cov). This was run on GitHub Actions Runners. These tools seem to work without issue on Desktop Windows (have not tried macOS or Linux).

I expected to see this happen: cc successfully compiled with -C instrument-coverage enabled

Instead, this happened: I get a SIGILL error under Linux, [SIGTRAP](signal: 5, SIGTRAP: trace/breakpoint trap) under macOS, and STATUS_ILLEGAL_INSTRUCTION on Windows.

Meta

rustc --version --verbose:

Linux

rustc 1.88.0-nightly (13e879094 2025-05-04)
binary: rustc
commit-hash: 13e87909494f2f31bce51bc106e2b629420d1235
commit-date: 2025-05-04
host: x86_64-unknown-linux-gnu
release: 1.88.0-nightly
LLVM version: 20.1.4

Windows

rustc 1.88.0-nightly (13e879094 2025-05-04)
binary: rustc
commit-hash: 13e87909494f2f31bce51bc106e2b629420d1235
commit-date: 2025-05-04
host: x86_64-pc-windows-msvc
release: 1.88.0-nightly
LLVM version: 20.1.4

macOS

rustc 1.88.0-nightly (13e879094 2025-05-04)
binary: rustc
commit-hash: 13e87909494f2f31bce51bc106e2b629420d1235
commit-date: 2025-05-04
host: aarch64-apple-darwin
release: 1.88.0-nightly
LLVM version: 20.1.4
Backtrace Linux

cargo llvm-cov nextest --cobertura --mcdc > "test-results/REDACTED.cobertura.xml"
warning: --mcdc option is unstable
info: cargo-llvm-cov currently setting cfg(coverage) and cfg(coverage_nightly); you can opt-out it by passing --no-cfg-coverage and --no-cfg-coverage-nightly

[...]

   Compiling cc v1.1.16
     Running `/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name cc --edition=2018 /__w/REDACTED/REDACTED/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cc-1.1.16/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no --cfg 'feature="parallel"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("jobserver", "parallel"))' -C metadata=8996d7acb1b451e7 -C extra-filename=-f8adae57810bd71c --out-dir /__w/REDACTED/REDACTED/target/llvm-cov-target/debug/deps -L dependency=/__w/REDACTED/REDACTED/target/llvm-cov-target/debug/deps --extern jobserver=/__w/REDACTED/REDACTED/target/llvm-cov-target/debug/deps/libjobserver-88b92c2e8f8204fb.rmeta --extern libc=/__w/REDACTED/REDACTED/target/llvm-cov-target/debug/deps/liblibc-03b59914ade46f2d.rmeta --extern shlex=/__w/REDACTED/REDACTED/target/llvm-cov-target/debug/deps/libshlex-be5013b75a6c003a.rmeta --cap-lints allow -Cinstrument-coverage -L ./ -C instrument-coverage -Z coverage-options=mcdc --cfg=coverage --cfg=coverage_nightly --cfg=trybuild_no_target`
error: rustc interrupted by SIGILL, printing backtrace

/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0f4a9aaf6ae6cf24.so(+0x398101f)[0x7fc5ae58101f]
/lib/x86_64-linux-gnu/libc.so.6(+0x3c050)[0x7fc5aaa5b050]
/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.20.1-rust-1.88.0-nightly(+0x8fa70bd)[0x7fc5a9da70bd]
/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.20.1-rust-1.88.0-nightly(_ZN4llvm19SelectionDAGBuilder5visitERKNS_11InstructionE+0x1eb)[0x7fc5a8d8e92b]
/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.20.1-rust-1.88.0-nightly(_ZN4llvm16SelectionDAGISel20SelectAllBasicBlocksERKNS_8FunctionE+0x13b7)[0x7fc5a8d909b9]
/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.20.1-rust-1.88.0-nightly(_ZN4llvm16SelectionDAGISel20runOnMachineFunctionERNS_15MachineFunctionE+0xc1)[0x7fc5a8dad55f]
/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.20.1-rust-1.88.0-nightly(_ZN4llvm22SelectionDAGISelLegacy20runOnMachineFunctionERNS_15MachineFunctionE+0x99)[0x7fc5a8dad3d9]
/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.20.1-rust-1.88.0-nightly(_ZN4llvm13FPPassManager13runOnFunctionERNS_8FunctionE+0xb05)[0x7fc5a8c28291]
/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.20.1-rust-1.88.0-nightly(_ZN4llvm13FPPassManager11runOnModuleERNS_6ModuleE+0x2f)[0x7fc5a8c276ef]
/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/libLLVM.so.20.1-rust-1.88.0-nightly(_ZN4llvm6legacy15PassManagerImpl3runERNS_6ModuleE+0x26f)[0x7fc5a9267383]
/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0f4a9aaf6ae6cf24.so(+0x6008ac2)[0x7fc5b0c08ac2]
/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0f4a9aaf6ae6cf24.so(+0x6008621)[0x7fc5b0c08621]
/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0f4a9aaf6ae6cf24.so(+0x6005be6)[0x7fc5b0c05be6]
/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0f4a9aaf6ae6cf24.so(+0x60058b4)[0x7fc5b0c058b4]
/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0f4a9aaf6ae6cf24.so(_RINvNtNtCs1FpB9HpxKJ1_3std3sys9backtrace28___rust_begin_short_backtraceNCINvXs0_CshDqY5VxCEGQ_18rustc_codegen_llvmNtB1g_18LlvmCodegenBackendNtNtNtCs34iPl0uoQEf_17rustc_codegen_ssa6traits7backend19ExtraBackendMethods18spawn_named_threadNCINvNtNtB2k_4back5write10spawn_workB1O_E0uE0uEB1g_+0x251)[0x7fc5b0c04011]
/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0f4a9aaf6ae6cf24.so(+0x609669c)[0x7fc5b0c9669c]
/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/librustc_driver-0f4a9aaf6ae6cf24.so(+0x6096a2b)[0x7fc5b0c96a2b]
/lib/x86_64-linux-gnu/libc.so.6(+0x891f5)[0x7fc5aaaa81f5]
/lib/x86_64-linux-gnu/libc.so.6(__clone+0x40)[0x7fc5aab27b00]

note: we would appreciate a report at https://github.com/rust-lang/rust
error: could not compile `cc` (lib)

Caused by:
  process didn't exit successfully: `/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/rustc --crate-name cc --edition=2018 /__w/REDACTED/REDACTED/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cc-1.1.16/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no --cfg 'feature="parallel"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("jobserver", "parallel"))' -C metadata=8996d7acb1b451e7 -C extra-filename=-f8adae57810bd71c --out-dir /__w/REDACTED/REDACTED/target/llvm-cov-target/debug/deps -L dependency=/__w/REDACTED/REDACTED/target/llvm-cov-target/debug/deps --extern jobserver=/__w/REDACTED/REDACTED/target/llvm-cov-target/debug/deps/libjobserver-88b92c2e8f8204fb.rmeta --extern libc=/__w/REDACTED/REDACTED/target/llvm-cov-target/debug/deps/liblibc-03b59914ade46f2d.rmeta --extern shlex=/__w/REDACTED/REDACTED/target/llvm-cov-target/debug/deps/libshlex-be5013b75a6c003a.rmeta --cap-lints allow -Cinstrument-coverage -L ./ -C instrument-coverage -Z coverage-options=mcdc --cfg=coverage --cfg=coverage_nightly --cfg=trybuild_no_target` (signal: 4, SIGILL: illegal instruction)
warning: build failed, waiting for other jobs to finish...
error: command `/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo test --no-run --message-format json-render-diagnostics --target-dir /__w/REDACTED/REDACTED/target/llvm-cov-target` exited with code 101
error: process didn't exit successfully: `/usr/local/rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo nextest run --manifest-path /__w/REDACTED/REDACTED/Cargo.toml --target-dir /__w/REDACTED/REDACTED/target/llvm-cov-target` (exit status: 101)

Backtrace Windows

cargo llvm-cov nextest --cobertura --mcdc > "test-results/REDACTED.cobertura.xml"
warning: --mcdc option is unstable
info: cargo-llvm-cov currently setting cfg(coverage) and cfg(coverage_nightly); you can opt-out it by passing --no-cfg-coverage and --no-cfg-coverage-nightly

[...]

   Compiling cc v1.1.16
     Running `C:\Users\runneradmin\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\bin\rustc.exe --crate-name cc --edition=2018 D:\a\tsp-toolkit-script-gen\tsp-toolkit-script-gen\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\cc-1.1.16\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no --cfg "feature=\"parallel\"" --check-cfg cfg(docsrs,test) --check-cfg "cfg(feature, values(\"jobserver\", \"parallel\"))" -C metadata=2dce8f0fbf27253e -C extra-filename=-991b9d71cf2ca524 --out-dir D:\a\tsp-toolkit-script-gen\tsp-toolkit-script-gen\target\llvm-cov-target\debug\deps -L dependency=D:\a\tsp-toolkit-script-gen\tsp-toolkit-script-gen\target\llvm-cov-target\debug\deps --extern jobserver=D:\a\tsp-toolkit-script-gen\tsp-toolkit-script-gen\target\llvm-cov-target\debug\deps\libjobserver-771c36a572dff3c3.rmeta --extern shlex=D:\a\tsp-toolkit-script-gen\tsp-toolkit-script-gen\target\llvm-cov-target\debug\deps\libshlex-34bee54341b4da13.rmeta --cap-lints allow -C instrument-coverage -Z coverage-options=mcdc --cfg=coverage --cfg=coverage_nightly --cfg=trybuild_no_target`
error: could not compile `cc` (lib)

Caused by:
  process didn't exit successfully: `C:\Users\runneradmin\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\bin\rustc.exe --crate-name cc --edition=2018 D:\a\tsp-toolkit-script-gen\tsp-toolkit-script-gen\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\cc-1.1.16\src\lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no --cfg "feature=\"parallel\"" --check-cfg cfg(docsrs,test) --check-cfg "cfg(feature, values(\"jobserver\", \"parallel\"))" -C metadata=2dce8f0fbf27253e -C extra-filename=-991b9d71cf2ca524 --out-dir D:\a\tsp-toolkit-script-gen\tsp-toolkit-script-gen\target\llvm-cov-target\debug\deps -L dependency=D:\a\tsp-toolkit-script-gen\tsp-toolkit-script-gen\target\llvm-cov-target\debug\deps --extern jobserver=D:\a\tsp-toolkit-script-gen\tsp-toolkit-script-gen\target\llvm-cov-target\debug\deps\libjobserver-771c36a572dff3c3.rmeta --extern shlex=D:\a\tsp-toolkit-script-gen\tsp-toolkit-script-gen\target\llvm-cov-target\debug\deps\libshlex-34bee54341b4da13.rmeta --cap-lints allow -C instrument-coverage -Z coverage-options=mcdc --cfg=coverage --cfg=coverage_nightly --cfg=trybuild_no_target` (exit code: 0xc000001d, STATUS_ILLEGAL_INSTRUCTION)
warning: build failed, waiting for other jobs to finish...
error: command `'C:\Users\runneradmin\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\bin\cargo.exe' test --no-run --message-format json-render-diagnostics --target-dir 'D:\a\tsp-toolkit-script-gen\tsp-toolkit-script-gen\target\llvm-cov-target'` exited with code 101
error: process didn't exit successfully: `C:\Users\runneradmin\.rustup\toolchains\nightly-x86_64-pc-windows-msvc\bin\cargo.exe nextest run --manifest-path D:\a\tsp-toolkit-script-gen\tsp-toolkit-script-gen\Cargo.toml --target-dir D:\a\tsp-toolkit-script-gen\tsp-toolkit-script-gen\target\llvm-cov-target` (exit code: 101)

Backtrace macOS

cargo llvm-cov nextest --cobertura --mcdc > "test-results/REDACTED.cobertura.xml"
warning: --mcdc option is unstable
info: cargo-llvm-cov currently setting cfg(coverage) and cfg(coverage_nightly); you can opt-out it by passing --no-cfg-coverage and --no-cfg-coverage-nightly

[...]

   Compiling cc v1.1.16
     Running `/Users/runner/.rustup/toolchains/nightly-aarch64-apple-darwin/bin/rustc --crate-name cc --edition=2018 /Users/runner/work/REDACTED/REDACTED/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cc-1.1.16/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no --cfg 'feature="parallel"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("jobserver", "parallel"))' -C metadata=c3b8ebb0918e49dc -C extra-filename=-969d5a180171e87e --out-dir /Users/runner/work/REDACTED/REDACTED/target/llvm-cov-target/debug/deps -L dependency=/Users/runner/work/REDACTED/REDACTED/target/llvm-cov-target/debug/deps --extern jobserver=/Users/runner/work/REDACTED/REDACTED/target/llvm-cov-target/debug/deps/libjobserver-dfe5801ba8ebe052.rmeta --extern libc=/Users/runner/work/REDACTED/REDACTED/target/llvm-cov-target/debug/deps/liblibc-12708f473cc4487d.rmeta --extern shlex=/Users/runner/work/REDACTED/REDACTED/target/llvm-cov-target/debug/deps/libshlex-282d31caf026f140.rmeta --cap-lints allow -C instrument-coverage -Z coverage-options=mcdc --cfg=coverage --cfg=coverage_nightly --cfg=trybuild_no_target`

error: could not compile `cc` (lib)

Caused by:
  process didn't exit successfully: `/Users/runner/.rustup/toolchains/nightly-aarch64-apple-darwin/bin/rustc --crate-name cc --edition=2018 /Users/runner/work/REDACTED/REDACTED/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/cc-1.1.16/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no --cfg 'feature="parallel"' --check-cfg 'cfg(docsrs,test)' --check-cfg 'cfg(feature, values("jobserver", "parallel"))' -C metadata=c3b8ebb0918e49dc -C extra-filename=-969d5a180171e87e --out-dir /Users/runner/work/REDACTED/REDACTED/target/llvm-cov-target/debug/deps -L dependency=/Users/runner/work/REDACTED/REDACTED/target/llvm-cov-target/debug/deps --extern jobserver=/Users/runner/work/REDACTED/REDACTED/target/llvm-cov-target/debug/deps/libjobserver-dfe5801ba8ebe052.rmeta --extern libc=/Users/runner/work/REDACTED/REDACTED/target/llvm-cov-target/debug/deps/liblibc-12708f473cc4487d.rmeta --extern shlex=/Users/runner/work/REDACTED/REDACTED/target/llvm-cov-target/debug/deps/libshlex-282d31caf026f140.rmeta --cap-lints allow -C instrument-coverage -Z coverage-options=mcdc --cfg=coverage --cfg=coverage_nightly --cfg=trybuild_no_target` (signal: 5, SIGTRAP: trace/breakpoint trap)
warning: build failed, waiting for other jobs to finish...
error: command `/Users/runner/.rustup/toolchains/nightly-aarch64-apple-darwin/bin/cargo test --no-run --message-format json-render-diagnostics --target-dir /Users/runner/work/REDACTED/REDACTED/target/llvm-cov-target` exited with code 101
error: process didn't exit successfully: `/Users/runner/.rustup/toolchains/nightly-aarch64-apple-darwin/bin/cargo nextest run --manifest-path /Users/runner/work/REDACTED/REDACTED/Cargo.toml --target-dir /Users/runner/work/REDACTED/REDACTED/target/llvm-cov-target` (exit status: 101)

@esarver esarver added the C-bug Category: This is a bug. label May 5, 2025
@rustbot rustbot added the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 5, 2025
@jieyouxu jieyouxu added A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example requires-nightly This issue requires a nightly compiler in some way. labels May 5, 2025
@jieyouxu
Copy link
Member

jieyouxu commented May 5, 2025

Triage notes: -Z coverage-options=mcdc

@jieyouxu jieyouxu removed the needs-triage This issue may need triage. Remove it if it has been sufficiently triaged. label May 5, 2025
@esarver
Copy link
Author

esarver commented May 5, 2025

@jieyouxu Thanks for pointing that out. I changed to using -Z coverage-options=branch and that seems to resolve the problem in my build.

@jieyouxu
Copy link
Member

jieyouxu commented May 5, 2025

I changed to using -Z coverage-options=branch and that seems to resolve the problem in my build.

Keeping this open, because if someone is able to, a reproducer for the -Z coverage-options=mcdc case would still be very helpful (most likely a genuine bug).

@jieyouxu
Copy link
Member

jieyouxu commented May 5, 2025

AFAIK the MCDC impl is still quite immature, backlinking to tracking issue #124144

@jieyouxu jieyouxu changed the title SIGILL when compiling cc with -C instrument-coverage SIGILL when compiling cc with -C instrument-coverage -Z coverage-options=mcdc May 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) C-bug Category: This is a bug. E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example requires-nightly This issue requires a nightly compiler in some way. 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

3 participants