Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Iris
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Pierre Roux
Iris
Commits
62a2b37a
Commit
62a2b37a
authored
5 years ago
by
Ralf Jung
Browse files
Options
Downloads
Patches
Plain Diff
pointer arithmetic: properly check the operation
parent
05e5b389
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
theories/heap_lang/lang.v
+7
-1
7 additions, 1 deletion
theories/heap_lang/lang.v
theories/heap_lang/metatheory.v
+1
-1
1 addition, 1 deletion
theories/heap_lang/metatheory.v
theories/heap_lang/proph_erasure.v
+1
-1
1 addition, 1 deletion
theories/heap_lang/proph_erasure.v
with
9 additions
and
3 deletions
theories/heap_lang/lang.v
+
7
−
1
View file @
62a2b37a
...
...
@@ -523,6 +523,12 @@ Definition bin_op_eval_bool (op : bin_op) (b1 b2 : bool) : option base_lit :=
|
OffsetOp
=>
None
(* Pointer arithmetic *)
end
.
Definition
bin_op_eval_loc
(
op
:
bin_op
)
(
l1
:
loc
)
(
v2
:
base_lit
)
:
option
base_lit
:=
match
op
,
v2
with
|
OffsetOp
,
(
LitInt
off
)
=>
Some
$
LitLoc
(
l1
+
ₗ
off
)
|
_,
_
=>
None
end
.
Definition
bin_op_eval
(
op
:
bin_op
)
(
v1
v2
:
val
)
:
option
val
:=
if
decide
(
op
=
EqOp
)
then
(* Crucially, this compares the same way as [CmpXchg]! *)
...
...
@@ -534,7 +540,7 @@ Definition bin_op_eval (op : bin_op) (v1 v2 : val) : option val :=
match
v1
,
v2
with
|
LitV
(
LitInt
n1
),
LitV
(
LitInt
n2
)
=>
LitV
<$>
bin_op_eval_int
op
n1
n2
|
LitV
(
LitBool
b1
),
LitV
(
LitBool
b2
)
=>
LitV
<$>
bin_op_eval_bool
op
b1
b2
|
LitV
(
LitLoc
l
),
LitV
(
LitInt
off
)
=>
Some
$
LitV
$
LitLoc
(
l
+
ₗ
off
)
|
LitV
(
LitLoc
l
1
),
LitV
v2
=>
LitV
<$>
bin_op_eval_loc
op
l1
v2
|
_,
_
=>
None
end
.
...
...
This diff is collapsed.
Click to expand it.
theories/heap_lang/metatheory.v
+
1
−
1
View file @
62a2b37a
...
...
@@ -88,7 +88,7 @@ Lemma bin_op_eval_closed op v1 v2 v':
is_closed_val
v1
→
is_closed_val
v2
→
bin_op_eval
op
v1
v2
=
Some
v'
→
is_closed_val
v'
.
Proof
.
rewrite
/
bin_op_eval
/
bin_op_eval_bool
/
bin_op_eval_int
;
rewrite
/
bin_op_eval
/
bin_op_eval_bool
/
bin_op_eval_int
/
bin_op_eval_loc
;
repeat
case_match
;
by
naive_solver
.
Qed
.
...
...
This diff is collapsed.
Click to expand it.
theories/heap_lang/proph_erasure.v
+
1
−
1
View file @
62a2b37a
...
...
@@ -174,7 +174,7 @@ Lemma bin_op_eval_erase op v1 v2 v' :
bin_op_eval
op
(
erase_val
v1
)
(
erase_val
v2
)
=
Some
v'
↔
∃
w
,
bin_op_eval
op
v1
v2
=
Some
w
∧
erase_val
w
=
v'
.
Proof
.
rewrite
/
bin_op_eval
/
bin_op_eval_int
/
bin_op_eval_bool
;
rewrite
/
bin_op_eval
/
bin_op_eval_int
/
bin_op_eval_bool
/
bin_op_eval_loc
;
split
;
[
intros
?|
intros
(?
&
?
&
?)];
repeat
(
case_match
;
simplify_eq
/=
);
eauto
.
-
eexists
_;
split
;
eauto
;
simpl
.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment