From 14a9bb4b267eeead8cd9503ee19e860a8bc0d763 Mon Sep 17 00:00:00 2001 From: xleroy Date: Thu, 28 Oct 2010 14:56:39 +0000 Subject: Float.intoffloat and Float.intuoffloat are now partial functions. (May fail if float is too big to be converted.) git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1544 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e --- cfrontend/Cshmgenproof.v | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'cfrontend/Cshmgenproof.v') diff --git a/cfrontend/Cshmgenproof.v b/cfrontend/Cshmgenproof.v index 4784e1ed..88f042de 100644 --- a/cfrontend/Cshmgenproof.v +++ b/cfrontend/Cshmgenproof.v @@ -361,8 +361,18 @@ Proof. destruct sg; econstructor; eauto. Qed. +Lemma make_intoffloat_correct: + forall e le m a sg f i, + eval_expr ge e le m a (Vfloat f) -> + cast_float_int sg f = Some i -> + eval_expr ge e le m (make_intoffloat a sg) (Vint i). +Proof. + unfold cast_float_int, make_intoffloat; intros. + destruct sg; econstructor; eauto; simpl; rewrite H0; auto. +Qed. + Hint Resolve make_intconst_correct make_floatconst_correct - make_floatofint_correct + make_floatofint_correct make_intoffloat_correct eval_Eunop eval_Ebinop: cshm. Hint Extern 2 (@eq trace _ _) => traceEq: cshm. @@ -650,7 +660,8 @@ Proof. (* cast_int_int *) destruct sz2; destruct si2; repeat econstructor; eauto with cshm. (* cast_float_int *) - destruct sz2; destruct si2; unfold make_intoffloat; repeat econstructor; eauto with cshm; simpl; auto. + exploit make_intoffloat_correct; eauto. intros A. + destruct sz2; destruct si2; eauto with cshm. (* cast_int_float *) destruct sz2; destruct si1; unfold make_floatofint; repeat econstructor; eauto with cshm; simpl; auto. (* cast_float_float *) -- cgit