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

Panic when debug-assertions=true in release profile #111

Open
pedantic79 opened this issue Jan 10, 2025 · 0 comments
Open

Panic when debug-assertions=true in release profile #111

pedantic79 opened this issue Jan 10, 2025 · 0 comments

Comments

@pedantic79
Copy link

This showed up during advent of code. I was trying different hashing algorithms to see which provided the best times. Out of habit, I keep debug-assertions = true and overflow-checks = false in release profile. Other hashing algorithms would work, but gxhash would panic.

Eventually, I reduced this to a minimum test case, which is just debug-assertions = true in release profile. This seems to occur on MacOS (Apple Silicon), but not Linux (x86-64).

Example repo: https://github.com/pedantic79/gxhash-test

» cargo +stable version
cargo 1.84.0 (66221abde 2024-11-19)
» RUST_BACKTRACE=1 cargo +stable run --release
    Blocking waiting for file lock on package cache
   Compiling rustversion v1.0.19
   Compiling gxhash v3.4.1
   Compiling gxhash-test v0.1.0 (/Users/dnn/gxhash-test)
    Finished `release` profile [optimized + debuginfo] target(s) in 4.13s
     Running `target/release/gxhash-test`
thread 'main' panicked at core/src/panicking.rs:223:5:
unsafe precondition(s) violated: ptr::copy_nonoverlapping requires that both pointer arguments are aligned and non-null and the specified memory ranges do not overlap
stack backtrace:
   0: rust_begin_unwind
             at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/panicking.rs:665:5
   1: core::panicking::panic_nounwind_fmt::runtime
             at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/core/src/panicking.rs:119:22
   2: core::panicking::panic_nounwind_fmt
             at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/core/src/intrinsics/mod.rs:3535:9
   3: core::panicking::panic_nounwind
             at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/core/src/panicking.rs:223:5
   4: core::hash::BuildHasher::hash_one
   5: hashbrown::map::make_hash
             at /rust/deps/hashbrown-0.15.0/src/map.rs:258:5
   6: hashbrown::rustc_entry::<impl hashbrown::map::HashMap<K,V,S,A>>::rustc_entry
             at /rust/deps/hashbrown-0.15.0/src/rustc_entry.rs:35:20
   7: std::collections::hash::map::HashMap<K,V,S>::entry
             at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/std/src/collections/hash/map.rs:854:19
   8: gxhash_test::part2
             at ./src/main.rs:6:15
   9: gxhash_test::main
             at ./src/main.rs:13:20
  10: core::ops::function::FnOnce::call_once
             at /rustc/9fc6b43126469e3858e2fe86cafb4f0fd5068869/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
thread caused non-unwinding panic. aborting.
[1]    34288 abort      RUST_BACKTRACE=1 cargo +stable run --release
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

No branches or pull requests

1 participant