rust-lang / backtrace-rs

Backtraces in Rust

Home Page:https://docs.rs/backtrace

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Execution of test cases at a particular compilation optimization level appears to be panic

cicilzx opened this issue · comments

When using -C opt-level=0 as the compilation optimization level, the test case tests/smoke.rs/smoke_test_frames() would trigger a panic.

This is the command to compile (All of these four command could trigger the panic):

RUSTFLAGS="-Z mir-opt-level=0 -C opt-level=0" cargo test
RUSTFLAGS="-Z mir-opt-level=1 -C opt-level=0" cargo test
RUSTFLAGS="-Z mir-opt-level=2 -C opt-level=0" cargo test
RUSTFLAGS="-Z mir-opt-level=3 -C opt-level=0" cargo test

But if I use other compilation optimization level such as RUSTFLAGS="-Z mir-opt-level=0 -C opt-level=1" cargo test, all the tests will pass.

This is the panic error message:

running 3 tests
test smoke_test_frames ... FAILED
test sp_smoke_test ... ok
test many_threads ... ok

failures:

---- smoke_test_frames stdout ----
symbol  ip:0x55f7c838ff7c address:0x55f7c838ff10 name:backtrace::backtrace::libunwind::trace::hc88d690e962aca95 file:/local/home/zixliu/crates/backtrace-rs/src/backtrace/libunwind.rs lineno:105 colno:5 
symbol  ip:0x55f7c838ff7c address:0x55f7c838ff10 name:backtrace::backtrace::trace_unsynchronized::h18de7c9777e5d77a file:/local/home/zixliu/crates/backtrace-rs/src/backtrace/mod.rs lineno:66 colno:5 
symbol  ip:0x55f7c838ff7c address:0x55f7c838ff10 name:backtrace::backtrace::trace::h7b0b0276e64a321b file:/local/home/zixliu/crates/backtrace-rs/src/backtrace/mod.rs lineno:53 colno:14 
symbol  ip:0x55f7c838ff7c address:0x55f7c838ff10 name:smoke::smoke_test_frames::frame_4::h64a9f3a13d11cd37 file:/local/home/zixliu/crates/backtrace-rs/tests/smoke.rs lineno:37 colno:9 
symbol  ip:0x55f7c838fe5e address:0x55f7c838fe50 name:smoke::smoke_test_frames::hc998f8b7a806127d file:/local/home/zixliu/crates/backtrace-rs/tests/smoke.rs lineno:31 colno:5 
symbol  ip:0x55f7c838fe5e address:0x55f7c838fe50 name:smoke::smoke_test_frames::{{closure}}::h6adfa69cca4fcd47 file:/local/home/zixliu/crates/backtrace-rs/tests/smoke.rs lineno:30 colno:23 
symbol  ip:0x55f7c838fe5e address:0x55f7c838fe50 name:core::ops::function::FnOnce::call_once::hd29b82b10be74ed9 file:/rustc/88189a71e4e4376eea82ac61db6a539612eb200a/library/core/src/ops/function.rs lineno:250 colno:5 
thread 'smoke_test_frames' panicked at tests/smoke.rs:132:9:
0x55f7c838fe50 < 0x55f7c838ff00 (frame_3 tests/smoke.rs:34:52)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


failures:
    smoke_test_frames

test result: FAILED. 2 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.12s

Sorry, I made a mistake. If we use -C opt-level=0, all the tests can pass, but if we use -C opt-level=0/2/3/s/z, this panic would be triggered.

Does it pass with -Copt-level=3 -Cdebuginfo=2?