Skip to content

Commit

Permalink
std::alloc: checking if the alignment is, at least, a word size.
Browse files Browse the repository at this point in the history
so we do not error (at least on solarish systems) in that case.
close GH-124787
  • Loading branch information
devnexen committed May 6, 2024
1 parent 8cef37d commit 1590c9d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion library/std/src/sys/pal/unix/alloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ cfg_if::cfg_if! {
// [3]: https://bugs.chromium.org/p/chromium/issues/detail?id=138579
// [4]: https://chromium.googlesource.com/chromium/src/base/+/master/
// /memory/aligned_memory.cc
libc::memalign(layout.align(), layout.size()) as *mut u8
if layout.align() >= crate::mem::size_of::<usize>() { libc::memalign(layout.align(), layout.size()) as *mut u8 } else { ptr::null_mut() }
}
} else if #[cfg(target_os = "wasi")] {
#[inline]
Expand Down

0 comments on commit 1590c9d

Please sign in to comment.