diff options
| author | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2024-03-08 20:41:29 +0000 |
|---|---|---|
| committer | bjorn3 <17426603+bjorn3@users.noreply.github.com> | 2024-03-08 20:41:29 +0000 |
| commit | 8fb8b087164e8271240f3114984fa53151e282fb (patch) | |
| tree | f891d1b3d7cff36dba67e14420e15fafd5ad5c9f /compiler/rustc_codegen_cranelift/src/constant.rs | |
| parent | a655e648a9f94d74263108366b83e677af56e35d (diff) | |
| parent | 54cbb6e7531f95e086d5c3dd0d5e73bfbe3545ba (diff) | |
| download | rust-8fb8b087164e8271240f3114984fa53151e282fb.tar.gz rust-8fb8b087164e8271240f3114984fa53151e282fb.zip | |
Merge commit '54cbb6e7531f95e086d5c3dd0d5e73bfbe3545ba' into sync_cg_clif-2024-03-08
Diffstat (limited to 'compiler/rustc_codegen_cranelift/src/constant.rs')
| -rw-r--r-- | compiler/rustc_codegen_cranelift/src/constant.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/rustc_codegen_cranelift/src/constant.rs b/compiler/rustc_codegen_cranelift/src/constant.rs index b6de688130c..18c5960ffc6 100644 --- a/compiler/rustc_codegen_cranelift/src/constant.rs +++ b/compiler/rustc_codegen_cranelift/src/constant.rs @@ -372,7 +372,13 @@ fn define_all_allocs(tcx: TyCtxt<'_>, module: &mut dyn Module, cx: &mut Constant } let bytes = alloc.inspect_with_uninit_and_ptr_outside_interpreter(0..alloc.len()).to_vec(); - data.define(bytes.into_boxed_slice()); + if bytes.is_empty() { + // FIXME(bytecodealliance/wasmtime#7918) cranelift-jit has a bug where it causes UB on + // empty data objects + data.define(Box::new([0])); + } else { + data.define(bytes.into_boxed_slice()); + } for &(offset, prov) in alloc.provenance().ptrs().iter() { let alloc_id = prov.alloc_id(); |
