@@ -1068,7 +1068,6 @@ Inductive extcall_free_sem (ge: Senv.t):
10681068 list val -> mem -> trace -> val -> mem -> Prop :=
10691069 | extcall_free_sem_ptr: forall b lo sz m m',
10701070 Mem.load Mptr m b (Ptrofs.unsigned lo - size_chunk Mptr) = Some (Vptrofs sz) ->
1071- Ptrofs.unsigned sz > 0 ->
10721071 Mem.free m b (Ptrofs.unsigned lo - size_chunk Mptr) (Ptrofs.unsigned lo + Ptrofs.unsigned sz) = Some m' ->
10731072 extcall_free_sem ge (Vptr b lo :: nil) m E0 Vundef m'
10741073 | extcall_free_sem_null: forall m,
@@ -1090,13 +1089,13 @@ Proof.
10901089(* readonly *)
10911090- eapply unchanged_on_readonly; eauto. inv H.
10921091+ eapply Mem.free_unchanged_on; eauto.
1093- intros. red; intros. elim H6 .
1092+ intros. red; intros. elim H5 .
10941093 apply Mem.perm_cur_max. apply Mem.perm_implies with Freeable; auto with mem.
10951094 eapply Mem.free_range_perm; eauto.
10961095+ apply Mem.unchanged_on_refl.
10971096(* mem extends *)
10981097- inv H.
1099- + inv H1. inv H8 . inv H6 .
1098+ + inv H1. inv H7 . inv H5 .
11001099 exploit Mem.load_extends; eauto. intros [v' [A B]].
11011100 assert (v' = Vptrofs sz).
11021101 { unfold Vptrofs in *; destruct Archi.ptr64; inv B; auto. }
@@ -1108,7 +1107,7 @@ Proof.
11081107 unfold loc_out_of_bounds; intros.
11091108 assert (Mem.perm m1 b i Max Nonempty).
11101109 { apply Mem.perm_cur_max. apply Mem.perm_implies with Freeable; auto with mem.
1111- eapply Mem.free_range_perm. eexact H4 . eauto. }
1110+ eapply Mem.free_range_perm. eexact H3 . eauto. }
11121111 tauto.
11131112+ inv H1. inv H5. replace v2 with Vnullptr.
11141113 exists Vundef; exists m1'; intuition auto.
@@ -1117,18 +1116,17 @@ Proof.
11171116 unfold Vnullptr in *; destruct Archi.ptr64; inv H3; auto.
11181117(* mem inject *)
11191118- inv H0.
1120- + inv H2. inv H7 . inv H9 .
1119+ + inv H2. inv H6 . inv H8 .
11211120 exploit Mem.load_inject; eauto. intros [v' [A B]].
11221121 assert (v' = Vptrofs sz).
11231122 { unfold Vptrofs in *; destruct Archi.ptr64; inv B; auto. }
11241123 subst v'.
11251124 assert (P: Mem.range_perm m1 b (Ptrofs.unsigned lo - size_chunk Mptr) (Ptrofs.unsigned lo + Ptrofs.unsigned sz) Cur Freeable).
11261125 eapply Mem.free_range_perm; eauto.
1127- exploit Mem.address_inject; eauto.
1128- apply Mem.perm_implies with Freeable; auto with mem.
1129- apply P. instantiate (1 := lo).
1130- generalize (size_chunk_pos Mptr); lia.
1131- intro EQ.
1126+ assert (EQ: Ptrofs.unsigned (Ptrofs.add lo (Ptrofs.repr delta)) = Ptrofs.unsigned lo + delta).
1127+ { eapply Mem.address_inject_gen with (p := Freeable); eauto.
1128+ right. apply P.
1129+ generalize (size_chunk_pos Mptr), (Ptrofs.unsigned_range sz); lia. }
11321130 exploit Mem.free_parallel_inject; eauto. intros (m2' & C & D).
11331131 exists f, Vundef, m2'; split.
11341132 apply extcall_free_sem_ptr with (sz := sz) (m' := m2').
0 commit comments