Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
J
javawlp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
impresshs
javawlp
Commits
38c61a9d
Verified
Commit
38c61a9d
authored
7 years ago
by
Ogilvie, D.H. (Duncan)
Browse files
Options
Downloads
Patches
Plain Diff
add null checks
parent
10ddd587
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/LogicIR/Backend/Z3.hs
+1
-1
1 addition, 1 deletion
src/LogicIR/Backend/Z3.hs
src/SimpleFormulaChecker.hs
+4
-4
4 additions, 4 deletions
src/SimpleFormulaChecker.hs
src/javawlp_edsl/src/nl/uu/javawlp_edsl/Main.java
+13
-6
13 additions, 6 deletions
src/javawlp_edsl/src/nl/uu/javawlp_edsl/Main.java
with
18 additions
and
11 deletions
src/LogicIR/Backend/Z3.hs
+
1
−
1
View file @
38c61a9d
...
...
@@ -50,7 +50,7 @@ lExprToZ3AstAlgebra = (flConst, flVar, flNot, flBinop, flComp, flQuant, flArray,
a
<-
a'
mkSelect
v
a
flNil
=
do
intSort
<-
mkBvSort
32
zero
<-
mkBitvector
32
0
-- (isNull, data, length) TODO: support proper null types
zero
<-
mkBitvector
32
0
x1337
-- (isNull, data, length) TODO: support proper null types
mkConstArray
intSort
zero
fnConst
n
=
mkBitvector
32
(
fromIntegral
n
)
fnUnop
o
a'
=
do
a
<-
a'
...
...
This diff is collapsed.
Click to expand it.
src/SimpleFormulaChecker.hs
+
4
−
4
View file @
38c61a9d
...
...
@@ -40,7 +40,7 @@ parseMethod (src, name) = do
-- return the relevant data
return
(
decls
,
mbody
,
env
)
where
--
| P
arse a Java source file, and extracts the necessary information from the compilation unit
--
p
arse a Java source file, and extracts the necessary information from the compilation unit
parseJava
::
FilePath
->
IO
CompilationUnit
parseJava
s
=
do
-- Get the source code
...
...
@@ -103,8 +103,7 @@ determineFormulaEq m1@(decls1, mbody1, env1) m2@(decls2, mbody2, env2) name = do
Sat
->
do
putStrLn
"formulas are NOT equivalent, model:"
case
model
of
Just
m
->
do
env
<-
newItpEnv
Nothing
(
Z3
.
Opts
.
opt
":pp.bv-literals"
False
)
s
<-
evalZ3WithEnv
(
modelToString
m
)
env
Just
m
->
do
s
<-
evalZ3
(
modelToString
m
)
putStr
s
_
->
return
()
where
...
...
@@ -132,4 +131,5 @@ testEq = compareSpec (edslSrc, "swap_spec1") (edslSrc, "swap_spec1")
testNeq
=
compareSpec
(
edslSrc
,
"swap_spec1"
)
(
edslSrc
,
"swap_spec2"
)
blub
=
compareSpec
(
edslSrc
,
"getMax_spec1"
)
(
edslSrc
,
"getMax_spec2"
)
blub2
=
compareSpec
(
edslSrc
,
"test1"
)
(
edslSrc
,
"test2"
)
blob
=
compareSpec
(
edslSrc
,
"blob1"
)
(
edslSrc
,
"blob1"
)
\ No newline at end of file
blob
=
compareSpec
(
edslSrc
,
"blob1"
)
(
edslSrc
,
"blob1"
)
nullTest
=
compareSpec
(
edslSrc
,
"null1"
)
(
edslSrc
,
"null2"
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/javawlp_edsl/src/nl/uu/javawlp_edsl/Main.java
+
13
−
6
View file @
38c61a9d
...
...
@@ -107,20 +107,27 @@ public class Main {
post
(
a
[
i
]
==
oldaj
);
}
public
static
void
blob1
(
int
[]
a
)
{
public
static
void
null1
(
int
[]
a
,
int
x
)
{
pre
(
a
!=
null
);
post
(
true
);
}
public
static
void
null2
(
int
[]
a
,
int
x
)
{
pre
(
exists
(
a
,
i
->
a
[
i
]
!=
0x1337
));
post
(
true
);
}
public
static
void
blob1
(
int
[]
a
)
{
pre
(
forall
(
a
,
i
->
{
return
a
[
i
]
==
0
;
}));
post
(
true
);
}
public
static
void
test1
(
int
[]
a
)
{
public
static
void
test1
(
int
[]
a
)
{
pre
(
exists
(
a
,
i
->
a
[
i
+
1
]
>
a
[
i
]));
post
(
true
);
}
public
static
void
test2
(
int
[]
a
)
{
public
static
void
test2
(
int
[]
a
)
{
pre
(
false
);
//pre(exists(a, i -> a[i+1] >= a[i]));
post
(
true
);
...
...
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