Skip to content

Commit 7db26ba

Browse files
Merge pull request #376 from kurtjd/fix-example-ub
Fix UB in heap init example docs
2 parents 680892b + a31f5fb commit 7db26ba

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

riscv-rt/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
2121

2222
### Fixed
2323

24+
- Fix undefined behavior in heap initialization example documentation
2425
- Fix stack allocation algorithm for multi-core targets without M extension
2526

2627
## [v0.16.0] - 2025-09-08

riscv-rt/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@
279279
//! fn main() {
280280
//! unsafe {
281281
//! let heap_bottom = riscv_rt::heap_start() as usize;
282-
//! let heap_size = &_heap_size as *const u8 as usize;
282+
//! let heap_size = core::ptr::addr_of!(_heap_size) as usize;
283283
//! some_allocator::initialize(heap_bottom, heap_size);
284284
//! }
285285
//! }

0 commit comments

Comments
 (0)