ere-risc0: allocator alignments test (#120)

Signed-off-by: Ignacio Hagopian <jsign.uy@gmail.com>
This commit is contained in:
Ignacio Hagopian
2025-09-03 13:18:09 +02:00
committed by GitHub
parent e4b1ccca54
commit 071deec1c3
3 changed files with 46 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
[package]
name = "ere-test-risc0-allocs-alignment"
version = "0.1.0"
edition = "2021"
[workspace]
[dependencies]
risc0-zkvm = { version = "3.0.1", default-features = false, features = [
"std",
"unstable",
] }
risc0-zkvm-platform = { version = "=2.0.4" }

View File

@@ -0,0 +1,11 @@
use risc0_zkvm::guest::env;
fn main() {
let alignment = env::read::<usize>();
let layout = std::alloc::Layout::from_size_align(1, alignment).unwrap();
let ptr = unsafe { std::alloc::alloc(layout) };
if ptr.is_null() {
panic!("allocation failed");
}
}