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

"tests/pass/panic/catch_panic.rs" test diverses with -O #3115

Closed
RalfJung opened this issue Oct 10, 2023 · 1 comment · Fixed by #3117
Closed

"tests/pass/panic/catch_panic.rs" test diverses with -O #3115

RalfJung opened this issue Oct 10, 2023 · 1 comment · Fixed by #3117

Comments

@RalfJung
Copy link
Member

To reproduce, run ./miri run tests/pass/panic/catch_panic.rs -O. This prints

thread 'main' panicked at tests/pass/panic/catch_panic.rs:51:27:
Hello from std::panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Caught panic message (&str): Hello from std::panic
thread 'main' panicked at tests/pass/panic/catch_panic.rs:52:26:
Hello from std::panic: 1
Caught panic message (String): Hello from std::panic: 1
thread 'main' panicked at tests/pass/panic/catch_panic.rs:54:9:
Hello from std::panic_any: 2
Caught panic message (String): Hello from std::panic_any: 2
thread 'main' panicked at tests/pass/panic/catch_panic.rs:56:27:
Box<dyn Any>
Failed to get caught panic message.
thread 'main' panicked at tests/pass/panic/catch_panic.rs:59:27:
Hello from core::panic
Caught panic message (&str): Hello from core::panic
thread 'main' panicked at tests/pass/panic/catch_panic.rs:60:26:
Hello from core::panic: 5
Caught panic message (String): Hello from core::panic: 5
thread 'main' panicked at tests/pass/panic/catch_panic.rs:64:20:
index out of bounds: the len is 3 but the index is 4
Caught panic message (String): index out of bounds: the len is 3 but the index is 4
thread 'main' panicked at tests/pass/panic/catch_panic.rs:68:20:
attempt to divide by zero
Caught panic message (&str): attempt to divide by zero
thread 'main' panicked at /home/r/.rustup/toolchains/miri/lib/rustlib/src/rust/library/core/src/ptr/const_ptr.rs:1360:13:
align_offset: align is not a power-of-two
Caught panic message (&str): align_offset: align is not a power-of-two
thread 'main' panicked at tests/pass/panic/catch_panic.rs:79:9:
assertion failed: false
Caught panic message (&str): assertion failed: false

and then just stops... not sure what is happening.

@RalfJung
Copy link
Member Author

-Zreport-progress says this are here

note: tracking was triggered
  --> tests/pass/panic/catch_panic.rs:84:9
   |
84 |         loop {}
   |         ^^^^^^^ progress report: current operation being executed is here
   |
   = note: so far, 17000000 basic blocks have been executed
   = note: BACKTRACE:
   = note: inside closure at tests/pass/panic/catch_panic.rs:84:9: 84:16
note: inside `do_panic_counter::<{closure@tests/pass/panic/catch_panic.rs:82:16: 82:26}>`
  --> tests/pass/panic/catch_panic.rs:40:5
   |
40 |     do_panic(old_val);
   |     ^^^^^^^^^^^^^^^^^
note: inside closure
  --> tests/pass/panic/catch_panic.rs:98:9
   |
98 |         do_panic_counter(do_panic)
   |         ^^^^^^^^^^^^^^^^^^^^^^^^^^

Hm... looks like this has nothing to do with optimizations and is simply a consequence of the test requiring debug assertions.

@bors bors closed this as completed in 38b2d51 Oct 10, 2023
RalfJung pushed a commit to RalfJung/rust that referenced this issue Oct 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant