Skip to content

Commit 1d16624

Browse files
committed
diagnostics: Explain why programs might run OOM in GenMC mode
GenMC's allocator can currently only allocate up to 4GB per thread. Authored-by: Ralf Jung
1 parent 8568c89 commit 1d16624

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

src/diagnostics.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,10 @@ pub fn report_result<'tcx>(
362362
vec![
363363
note!("this is likely not a bug in the program; it indicates that the program performed an operation that Miri does not support"),
364364
],
365+
ResourceExhaustion(ResourceExhaustionInfo::AddressSpaceFull) if ecx.machine.data_race.as_genmc_ref().is_some() =>
366+
vec![
367+
note!("in GenMC mode, the address space is limited to 4GB per thread, and addresses cannot be reused")
368+
],
365369
UndefinedBehavior(AlignmentCheckFailed { .. })
366370
if ecx.machine.check_alignment == AlignmentCheck::Symbolic
367371
=>

tests/genmc/fail/simple/alloc_large.multiple.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ error: resource exhaustion: there are no more free addresses in the address spac
55
LL | AllocInit::Uninitialized => alloc.allocate(layout),
66
| ^^^^^^^^^^^^^^^^^^^^^^ resource exhaustion occurred here
77
|
8+
= help: in GenMC mode, the address space is limited to 4GB per thread, and addresses cannot be reused
89
= note: BACKTRACE:
910
= note: inside `alloc::raw_vec::RawVecInner::try_allocate_in` at RUSTLIB/alloc/src/raw_vec/mod.rs:LL:CC
1011
= note: inside `alloc::raw_vec::RawVecInner::with_capacity_in` at RUSTLIB/alloc/src/raw_vec/mod.rs:LL:CC

tests/genmc/fail/simple/alloc_large.single.stderr

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ error: resource exhaustion: there are no more free addresses in the address spac
55
LL | AllocInit::Uninitialized => alloc.allocate(layout),
66
| ^^^^^^^^^^^^^^^^^^^^^^ resource exhaustion occurred here
77
|
8+
= help: in GenMC mode, the address space is limited to 4GB per thread, and addresses cannot be reused
89
= note: BACKTRACE:
910
= note: inside `alloc::raw_vec::RawVecInner::try_allocate_in` at RUSTLIB/alloc/src/raw_vec/mod.rs:LL:CC
1011
= note: inside `alloc::raw_vec::RawVecInner::with_capacity_in` at RUSTLIB/alloc/src/raw_vec/mod.rs:LL:CC

0 commit comments

Comments
 (0)