diff options
author | Xavier Leroy <xavier.leroy@inria.fr> | 2015-06-30 14:48:17 +0200 |
---|---|---|
committer | Xavier Leroy <xavier.leroy@inria.fr> | 2015-06-30 14:48:17 +0200 |
commit | bdbf444704c031a37039d4aeb2f19d05550afbd6 (patch) | |
tree | ec101477946f1be805aa0e200bb5b7d82a45b1f3 /cfrontend/Cshmgenproof.v | |
parent | ff62587774f6ca437c887cc3ff5d079895c5e214 (diff) | |
download | compcert-kvx-bdbf444704c031a37039d4aeb2f19d05550afbd6.tar.gz compcert-kvx-bdbf444704c031a37039d4aeb2f19d05550afbd6.zip |
Signedness issue in specification of subtraction between two pointers.
Diffstat (limited to 'cfrontend/Cshmgenproof.v')
-rw-r--r-- | cfrontend/Cshmgenproof.v | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/cfrontend/Cshmgenproof.v b/cfrontend/Cshmgenproof.v index 025d7b66..c69d0c0a 100644 --- a/cfrontend/Cshmgenproof.v +++ b/cfrontend/Cshmgenproof.v @@ -490,8 +490,19 @@ Proof. destruct (classify_sub tya tyb); inv MAKE. - destruct va; try discriminate; destruct vb; inv SEM; eauto with cshm. - destruct va; try discriminate; destruct vb; inv SEM. - destruct (eq_block b0 b1); try discriminate. destruct (Int.eq (Int.repr (sizeof ce ty)) Int.zero) eqn:E; inv H0. - econstructor; eauto with cshm. rewrite dec_eq_true. simpl. rewrite E; auto. + destruct (eq_block b0 b1); try discriminate. + set (sz := sizeof ce ty) in *. + destruct (zlt 0 sz); try discriminate. + destruct (zle sz Int.max_signed); simpl in H0; inv H0. + econstructor; eauto with cshm. + rewrite dec_eq_true; simpl. + assert (E: Int.signed (Int.repr sz) = sz). + { apply Int.signed_repr. generalize Int.min_signed_neg; omega. } + predSpec Int.eq Int.eq_spec (Int.repr sz) Int.zero. + rewrite H in E; rewrite Int.signed_zero in E; omegaContradiction. + predSpec Int.eq Int.eq_spec (Int.repr sz) Int.mone. + rewrite H0 in E; rewrite Int.signed_mone in E; omegaContradiction. + rewrite andb_false_r; auto. - destruct va; try discriminate; destruct vb; inv SEM; eauto with cshm. - eapply make_binarith_correct; eauto; intros; auto. Qed. |