summaryrefslogtreecommitdiff
path: root/arm
diff options
context:
space:
mode:
authorGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2012-06-09 08:49:06 +0000
committerGravatar xleroy <xleroy@fca1b0fc-160b-0410-b1d3-a4f43f01ea2e>2012-06-09 08:49:06 +0000
commitf3250c32ff42ae18fd03a5311c1f0caec3415aba (patch)
treeb37da52bcf8015c4b29bb8387c30727e2b4de824 /arm
parent326d33e5b0f9dc0d3ccf6d75c62fedbc3ca085e5 (diff)
Make min_int / -1 and min_int % -1 semantically undefined
git-svn-id: https://yquem.inria.fr/compcert/svn/compcert/trunk@1919 fca1b0fc-160b-0410-b1d3-a4f43f01ea2e
Diffstat (limited to 'arm')
-rw-r--r--arm/ConstpropOp.vp8
-rw-r--r--arm/ConstpropOpproof.v3
-rw-r--r--arm/Op.v5
3 files changed, 11 insertions, 5 deletions
diff --git a/arm/ConstpropOp.vp b/arm/ConstpropOp.vp
index c0a04f0..0f06703 100644
--- a/arm/ConstpropOp.vp
+++ b/arm/ConstpropOp.vp
@@ -112,8 +112,12 @@ Nondetfunction eval_static_operation (op: operation) (vl: list approx) :=
| Orsubshift s, I n1 :: I n2 :: nil => I(Int.sub (eval_static_shift s n2) n1)
| Orsubimm n, I n1 :: nil => I (Int.sub n n1)
| Omul, I n1 :: I n2 :: nil => I(Int.mul n1 n2)
- | Odiv, I n1 :: I n2 :: nil => if Int.eq n2 Int.zero then Unknown else I(Int.divs n1 n2)
- | Odivu, I n1 :: I n2 :: nil => if Int.eq n2 Int.zero then Unknown else I(Int.divu n1 n2)
+ | Odiv, I n1 :: I n2 :: nil =>
+ if Int.eq n2 Int.zero then Unknown else
+ if Int.eq n1 (Int.repr Int.min_signed) && Int.eq n2 Int.mone then Unknown
+ else I(Int.divs n1 n2)
+ | Odivu, I n1 :: I n2 :: nil =>
+ if Int.eq n2 Int.zero then Unknown else I(Int.divu n1 n2)
| Oand, I n1 :: I n2 :: nil => I(Int.and n1 n2)
| Oandshift s, I n1 :: I n2 :: nil => I(Int.and n1 (eval_static_shift s n2))
| Oandimm n, I n1 :: nil => I(Int.and n1 n)
diff --git a/arm/ConstpropOpproof.v b/arm/ConstpropOpproof.v
index 242f29b..4c38d5e 100644
--- a/arm/ConstpropOpproof.v
+++ b/arm/ConstpropOpproof.v
@@ -138,7 +138,8 @@ Proof.
rewrite Int.sub_add_opp. rewrite shift_symbol_address. rewrite Val.sub_add_opp. auto.
rewrite Val.sub_add_opp. rewrite Val.add_assoc. rewrite Int.sub_add_opp. auto.
rewrite Int.sub_add_opp. rewrite shift_symbol_address. rewrite Val.sub_add_opp. auto.
- destruct (Int.eq n2 Int.zero); inv H0. simpl; auto.
+ destruct (Int.eq n2 Int.zero). inv H0.
+ destruct (Int.eq n1 (Int.repr Int.min_signed) && Int.eq n2 Int.mone); inv H0; simpl; auto.
destruct (Int.eq n2 Int.zero); inv H0. simpl; auto.
destruct (Int.ltu n2 Int.iwordsize); simpl; auto.
destruct (Int.ltu n2 Int.iwordsize); simpl; auto.
diff --git a/arm/Op.v b/arm/Op.v
index 3353416..fa05288 100644
--- a/arm/Op.v
+++ b/arm/Op.v
@@ -383,7 +383,8 @@ Proof with (try exact I).
generalize (S s v1). destruct v0; destruct (eval_shift s v1); simpl; intuition. destruct (zeq b0 b)...
destruct v0...
destruct v0; destruct v1...
- destruct v0; destruct v1; simpl in H0; inv H0. destruct (Int.eq i0 Int.zero); inv H2...
+ destruct v0; destruct v1; simpl in H0; inv H0.
+ destruct (Int.eq i0 Int.zero || Int.eq i (Int.repr Int.min_signed) && Int.eq i0 Int.mone); inv H2...
destruct v0; destruct v1; simpl in H0; inv H0. destruct (Int.eq i0 Int.zero); inv H2...
destruct v0; destruct v1...
generalize (S s v1). destruct v0; destruct (eval_shift s v1); simpl; tauto.
@@ -841,7 +842,7 @@ Proof.
inv H4; inv H2; simpl; auto.
inv H4; inv H3; simpl in H1; inv H1. simpl.
- destruct (Int.eq i0 Int.zero); inv H2. TrivialExists.
+ destruct (Int.eq i0 Int.zero || Int.eq i (Int.repr Int.min_signed) && Int.eq i0 Int.mone); inv H2. TrivialExists.
inv H4; inv H3; simpl in H1; inv H1. simpl.
destruct (Int.eq i0 Int.zero); inv H2. TrivialExists.