Skip to content
Snippets Groups Projects
Commit 8d2e4096 authored by Ralf Jung's avatar Ralf Jung
Browse files

document pointer comparison non-determinism

parent 4812a926
No related branches found
No related tags found
No related merge requests found
Pipeline #
......@@ -216,6 +216,13 @@ Fixpoint free_mem (l:loc) (n:nat) (σ:state) : state :=
Inductive lit_eq (σ : state) : base_lit base_lit Prop :=
| IntRefl z : lit_eq σ (LitInt z) (LitInt z)
| LocRefl l : lit_eq σ (LitLoc l) (LitLoc l)
(* Comparing unallocated pointers can non-deterministically say they are equal
even if they are not. Given that our `free` actually makes addresses
re-usable, this may not be strictly necessary, but it is the most
conservative choice that avoids UB (and we cannot use UB as this operation is
possible in safe Rust). See
<https://internals.rust-lang.org/t/comparing-dangling-pointers/3019> for some
more background. *)
| LocUnallocL l1 l2 :
σ !! l1 = None
lit_eq σ (LitLoc l1) (LitLoc l2)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment