Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
inox
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
Package registry
Model registry
Operate
Environments
Terraform modules
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
LARA
inox
Commits
5a527dd1
Commit
5a527dd1
authored
13 years ago
by
Régis Blanc
Browse files
Options
Downloads
Patches
Plain Diff
path constraint of let in function closure might cause issues with array equality
parent
d6322dc8
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/scala/leon/ArrayTransformation.scala
+6
-7
6 additions, 7 deletions
src/main/scala/leon/ArrayTransformation.scala
src/main/scala/leon/FunctionClosure.scala
+2
-2
2 additions, 2 deletions
src/main/scala/leon/FunctionClosure.scala
with
8 additions
and
9 deletions
src/main/scala/leon/ArrayTransformation.scala
+
6
−
7
View file @
5a527dd1
...
...
@@ -28,18 +28,18 @@ object ArrayTransformation extends Pass {
})
val
freshFunName
=
FreshIdentifier
(
fd
.
id
.
name
)
val
freshFunDef
=
new
FunDef
(
freshFunName
,
transform
(
fd
.
returnType
),
newArgs
)
fd2fd
+=
(
fd
->
freshFunDef
)
freshFunDef
.
fromLoop
=
fd
.
fromLoop
freshFunDef
.
parent
=
fd
.
parent
freshFunDef
.
precondition
=
fd
.
precondition
.
map
(
transform
)
freshFunDef
.
postcondition
=
fd
.
postcondition
.
map
(
transform
)
freshFunDef
.
addAnnotation
(
fd
.
annotations
.
toSeq
:_
*
)
fd2fd
+=
(
fd
->
freshFunDef
)
freshFunDef
}
else
fd
}
else
fd
})
allFuns
.
zip
(
newFuns
).
foreach
{
case
(
ofd
,
nfd
)
=>
ofd
.
body
.
map
(
body
=>
{
nfd
.
precondition
=
ofd
.
precondition
.
map
(
transform
)
nfd
.
postcondition
=
ofd
.
postcondition
.
map
(
transform
)
val
newBody
=
transform
(
body
)
nfd
.
body
=
Some
(
newBody
)
})}
...
...
@@ -76,7 +76,7 @@ object ArrayTransformation extends Pass {
val
ir
=
transform
(
i
)
val
length
=
TupleSelect
(
ar
,
2
).
setType
(
Int32Type
)
IfExpr
(
And
(
GreaterEquals
(
i
,
IntLiteral
(
0
)),
LessThan
(
i
,
length
)),
And
(
GreaterEquals
(
i
r
,
IntLiteral
(
0
)),
LessThan
(
i
r
,
length
)),
ArraySelect
(
TupleSelect
(
ar
,
1
),
ir
).
setType
(
sel
.
getType
).
setPosInfo
(
sel
),
Error
(
"Index out of bound"
).
setType
(
sel
.
getType
).
setPosInfo
(
sel
)
).
setType
(
sel
.
getType
)
...
...
@@ -88,14 +88,13 @@ object ArrayTransformation extends Pass {
val
Variable
(
id
)
=
ar
val
length
=
TupleSelect
(
ar
,
2
).
setType
(
Int32Type
)
val
array
=
TupleSelect
(
ar
,
1
).
setType
(
ArrayType
(
v
.
getType
))
//val Tuple(Seq(Variable(id), length)) = ar
IfExpr
(
And
(
GreaterEquals
(
i
,
IntLiteral
(
0
)),
LessThan
(
i
,
length
)),
Block
(
Seq
(
Assignment
(
id
,
Tuple
(
Seq
(
ArrayUpdated
(
array
,
i
,
v
).
setType
(
array
.
getType
).
setPosInfo
(
up
),
ArrayUpdated
(
array
,
i
r
,
v
r
).
setType
(
array
.
getType
).
setPosInfo
(
up
),
length
)
).
setType
(
TupleType
(
Seq
(
array
.
getType
,
Int32Type
))))),
IntLiteral
(
0
)),
...
...
@@ -162,12 +161,12 @@ object ArrayTransformation extends Pass {
})
val
freshFunName
=
FreshIdentifier
(
fd
.
id
.
name
)
val
freshFunDef
=
new
FunDef
(
freshFunName
,
transform
(
fd
.
returnType
),
newArgs
)
fd2fd
+=
(
fd
->
freshFunDef
)
freshFunDef
.
fromLoop
=
fd
.
fromLoop
freshFunDef
.
parent
=
fd
.
parent
freshFunDef
.
precondition
=
fd
.
precondition
.
map
(
transform
)
freshFunDef
.
postcondition
=
fd
.
postcondition
.
map
(
transform
)
freshFunDef
.
addAnnotation
(
fd
.
annotations
.
toSeq
:_
*
)
fd2fd
+=
(
fd
->
freshFunDef
)
freshFunDef
}
else
fd
val
newBody
=
transform
(
body
)
...
...
This diff is collapsed.
Click to expand it.
src/main/scala/leon/FunctionClosure.scala
+
2
−
2
View file @
5a527dd1
...
...
@@ -87,9 +87,9 @@ object FunctionClosure extends Pass {
}
case
l
@
Let
(
i
,
e
,
b
)
=>
{
val
re
=
functionClosure
(
e
,
bindedVars
)
pathConstraints
::=
Equals
(
Variable
(
i
),
re
)
//
pathConstraints ::= Equals(Variable(i), re)
val
rb
=
functionClosure
(
b
,
bindedVars
+
i
)
pathConstraints
=
pathConstraints
.
tail
//
pathConstraints = pathConstraints.tail
Let
(
i
,
re
,
rb
).
setType
(
l
.
getType
)
}
case
n
@
NAryOperator
(
args
,
recons
)
=>
{
...
...
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