Mentions légales du service
Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
why3
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Monitor
Service Desk
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Why3
why3
Commits
3d0e7f9f
Commit
3d0e7f9f
authored
12 years ago
by
MARCHE Claude
Browse files
Options
Downloads
Patches
Plain Diff
jessie3, machine ints
parent
d3adb164
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/jessie/ACSLtoWhy3.ml
+28
-16
28 additions, 16 deletions
src/jessie/ACSLtoWhy3.ml
src/jessie/register.ml
+1
-1
1 addition, 1 deletion
src/jessie/register.ml
src/jessie/tests/basic/incr.c
+4
-2
4 additions, 2 deletions
src/jessie/tests/basic/incr.c
with
33 additions
and
19 deletions
src/jessie/ACSLtoWhy3.ml
+
28
−
16
View file @
3d0e7f9f
...
...
@@ -124,12 +124,14 @@ let mach_int_modules, mach_int_theories =
let
int32_module
:
Mlw_module
.
modul
=
Stdlib
.
Mstr
.
find
"Int32"
mach_int_modules
let
int32_type
:
Mlw_ty
.
T
.
i
tysymbol
=
Mlw_module
.
ns_find_
i
ts
int32_module
.
Mlw_module
.
mod_export
[
"int32"
]
let
int32_type
:
Why3
.
Ty
.
tysymbol
=
Mlw_module
.
ns_find_ts
int32_module
.
Mlw_module
.
mod_export
[
"int32"
]
let
add32_fun
:
Mlw_expr
.
psymbol
=
Mlw_module
.
ns_find_ps
int32_module
.
Mlw_module
.
mod_export
[
"add"
]
let
int32ofint_fun
:
Mlw_expr
.
psymbol
=
Mlw_module
.
ns_find_ps
int32_module
.
Mlw_module
.
mod_export
[
"of_int"
]
(* array.Array module *)
...
...
@@ -156,12 +158,14 @@ let array_type : Mlw_ty.T.itysymbol =
let
unit_type
=
Ty
.
ty_tuple
[]
let
mlw_int_type
=
Mlw_ty
.
ity_pur
Ty
.
ts_int
[]
let
mlw_int32_type
=
Mlw_ty
.
ity_
app
int32_type
[]
[]
let
mlw_int32_type
=
Mlw_ty
.
ity_
pur
int32_type
[]
let
ctype
ty
=
match
ty
with
|
TVoid
_attr
->
Mlw_ty
.
ity_unit
|
TInt
(
_
,
_
)
->
mlw_int32_type
|
TInt
(
IInt
,
_
)
->
mlw_int32_type
|
TInt
(
_
,
_
)
->
Self
.
not_yet_implemented
"ctype TInt"
|
TFloat
(
_
,
_
)
->
Self
.
not_yet_implemented
"ctype TFloat"
|
TPtr
(
TInt
(
_
,_
)
,
_attr
)
->
...
...
@@ -743,10 +747,20 @@ let binop op e1 e2 =
let
constant
c
=
match
c
with
|
CInt64
(
_t
,_
ikind
,
Some
s
)
->
Number
.
ConstInt
(
Literals
.
integer
s
)
|
CInt64
(
t
,_
ikind
,
None
)
->
Number
.
ConstInt
(
Literals
.
integer
(
Integer
.
to_string
t
))
|
CInt64
(
t
,
IInt
,
sopt
)
->
let
s
=
match
sopt
with
|
Some
s
->
s
|
None
->
Integer
.
to_string
t
in
let
n
=
Mlw_expr
.
e_const
(
Number
.
ConstInt
(
Literals
.
integer
s
))
in
begin
try
Mlw_expr
.
e_app
(
Mlw_expr
.
e_arrow
int32ofint_fun
[
mlw_int_type
]
mlw_int32_type
)
[
n
]
with
_
->
Self
.
fatal
"bla"
end
|
CInt64
(
_t
,_
ikind
,
_
)
->
Self
.
not_yet_implemented
"CInt64"
|
CStr
_
|
CWStr
_
|
CChr
_
...
...
@@ -756,7 +770,7 @@ let constant c =
let
rec
expr
e
=
match
e
.
enode
with
|
Const
c
->
Mlw_expr
.
e_const
(
constant
c
)
|
Const
c
->
constant
c
|
Lval
lv
->
lval
lv
|
BinOp
(
op
,
e1
,
e2
,
_loc
)
->
binop
op
(
expr
e1
)
(
expr
e2
)
...
...
@@ -796,17 +810,12 @@ and lval (host,offset) =
|
Mlw_ty
.
VTvalue
ity
->
ity
|
Mlw_ty
.
VTarrow
_
->
assert
false
in
begin
try
Mlw_expr
.
e_lapp
map_get
[
e
;
expr
i
]
ity
Mlw_expr
.
e_lapp
map_get
[
e
;
expr
i
]
ity
(*
let ty = ctype ty in
let t = Mlw_expr.e_app (mk_get ity ty) [e] in
t (* Mlw_expr.e_lapp map_get [t;expr i] ity *)
*)
with
Mlw_ty
.
TypeMismatch
(
ity1
,
ity2
,_
ity_subst
)
->
Self
.
fatal
"e[i]: TypeMismatch(%a,%a,_)"
Mlw_pretty
.
print_ity
ity1
Mlw_pretty
.
print_ity
ity2
end
|
Mem
_
,
_
->
Self
.
not_yet_implemented
"lval Mem"
...
...
@@ -1120,6 +1129,9 @@ let prog p =
Self
.
result
"made %d function(s)"
(
List
.
length
functions
);
let
m
=
Mlw_module
.
close_module
m
in
List
.
rev
(
m
.
Mlw_module
.
mod_theory
::
theories
)
;
with
Exit
as
e
->
with
(
Exit
|
Not_found
|
Mlw_ty
.
TypeMismatch
_
)
as
e
->
Self
.
fatal
"Exception raised during translation to Why3:@ %a@."
Exn_printer
.
exn_printer
e
(* | Mlw_ty.TypeMismatch(ity1,ity2,_ity_subst) -> *)
(* Self.fatal "TypeMismatch(%a,%a,_)" *)
(* Mlw_pretty.print_ity ity1 Mlw_pretty.print_ity ity2 *)
This diff is collapsed.
Click to expand it.
src/jessie/register.ml
+
1
−
1
View file @
3d0e7f9f
...
...
@@ -59,7 +59,7 @@ let process () =
List
.
fold_left
(
get_prover
ACSLtoWhy3
.
config
ACSLtoWhy3
.
env
)
[]
[
"Z42"
,
"Z3,4.3.1"
;
[
(*
"Z42", "Z3,4.3.1";
*)
"Z32"
,
"Z3,3.2"
;
"C24"
,
"CVC3,2.4.1"
;
"C22"
,
"CVC3,2.2"
;
...
...
This diff is collapsed.
Click to expand it.
src/jessie/tests/basic/incr.c
+
4
−
2
View file @
3d0e7f9f
...
...
@@ -3,12 +3,13 @@
*/
/*
@
ensures \result == x+1;
/* ensures \result == x+1;
@*/
int
f
(
int
x
)
{
return
x
+
1
;
return
/* x+ */
1
;
}
#if 0
int g;
...
...
@@ -18,6 +19,7 @@ void h(int x) {
g += x;
}
#endif
/*
Local Variables:
...
...
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