Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
Iris
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
116
Issues
116
List
Boards
Labels
Service Desk
Milestones
Merge Requests
22
Merge Requests
22
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Iris
Iris
Commits
62a2b37a
Commit
62a2b37a
authored
Dec 06, 2019
by
Ralf Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pointer arithmetic: properly check the operation
parent
05e5b389
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
3 deletions
+9
-3
theories/heap_lang/lang.v
theories/heap_lang/lang.v
+7
-1
theories/heap_lang/metatheory.v
theories/heap_lang/metatheory.v
+1
-1
theories/heap_lang/proph_erasure.v
theories/heap_lang/proph_erasure.v
+1
-1
No files found.
theories/heap_lang/lang.v
View file @
62a2b37a
...
@@ -523,6 +523,12 @@ Definition bin_op_eval_bool (op : bin_op) (b1 b2 : bool) : option base_lit :=
...
@@ -523,6 +523,12 @@ Definition bin_op_eval_bool (op : bin_op) (b1 b2 : bool) : option base_lit :=
|
OffsetOp
=>
None
(* Pointer arithmetic *)
|
OffsetOp
=>
None
(* Pointer arithmetic *)
end
.
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
:
=
Definition
bin_op_eval
(
op
:
bin_op
)
(
v1
v2
:
val
)
:
option
val
:
=
if
decide
(
op
=
EqOp
)
then
if
decide
(
op
=
EqOp
)
then
(* Crucially, this compares the same way as [CmpXchg]! *)
(* Crucially, this compares the same way as [CmpXchg]! *)
...
@@ -534,7 +540,7 @@ Definition bin_op_eval (op : bin_op) (v1 v2 : val) : option val :=
...
@@ -534,7 +540,7 @@ Definition bin_op_eval (op : bin_op) (v1 v2 : val) : option val :=
match
v1
,
v2
with
match
v1
,
v2
with
|
LitV
(
LitInt
n1
),
LitV
(
LitInt
n2
)
=>
LitV
<$>
bin_op_eval_int
op
n1
n2
|
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
(
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
|
_
,
_
=>
None
end
.
end
.
...
...
theories/heap_lang/metatheory.v
View file @
62a2b37a
...
@@ -88,7 +88,7 @@ Lemma bin_op_eval_closed op v1 v2 v':
...
@@ -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
v1
→
is_closed_val
v2
→
bin_op_eval
op
v1
v2
=
Some
v'
→
is_closed_val
v'
.
is_closed_val
v'
.
Proof
.
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
.
repeat
case_match
;
by
naive_solver
.
Qed
.
Qed
.
...
...
theories/heap_lang/proph_erasure.v
View file @
62a2b37a
...
@@ -174,7 +174,7 @@ Lemma bin_op_eval_erase op v1 v2 v' :
...
@@ -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'
↔
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'
.
∃
w
,
bin_op_eval
op
v1
v2
=
Some
w
∧
erase_val
w
=
v'
.
Proof
.
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
(?&?&?)]
;
split
;
[
intros
?|
intros
(?&?&?)]
;
repeat
(
case_match
;
simplify_eq
/=)
;
eauto
.
repeat
(
case_match
;
simplify_eq
/=)
;
eauto
.
-
eexists
_;
split
;
eauto
;
simpl
.
-
eexists
_;
split
;
eauto
;
simpl
.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment