Skip to content
Snippets Groups Projects
Commit 4d4a3ff1 authored by Regis Blanc's avatar Regis Blanc Committed by Régis Blanc
Browse files

leon finds data racing counter-example

parent b1fcc592
No related branches found
No related tags found
No related merge requests found
...@@ -54,7 +54,7 @@ object IntroduceGlobalStatePhase extends TransformationPhase { ...@@ -54,7 +54,7 @@ object IntroduceGlobalStatePhase extends TransformationPhase {
} }
private def extendFunDefWithState(fd: FunDef, stateCCD: CaseClassDef)(ctx: LeonContext): FunDef = { private def extendFunDefWithState(fd: FunDef, stateCCD: CaseClassDef)(ctx: LeonContext): FunDef = {
val newParams = fd.params :+ ValDef(FreshIdentifier("state", stateCCD.typed)) val newParams = fd.params :+ ValDef(FreshIdentifier("globalState", stateCCD.typed))
val newFunDef = new FunDef(fd.id.freshen, fd.tparams, newParams, fd.returnType) val newFunDef = new FunDef(fd.id.freshen, fd.tparams, newParams, fd.returnType)
newFunDef.addFlags(fd.flags) newFunDef.addFlags(fd.flags)
newFunDef.setPos(fd) newFunDef.setPos(fd)
......
...@@ -34,12 +34,14 @@ object DataRacing { ...@@ -34,12 +34,14 @@ object DataRacing {
case (RunnableNil(), RunnableNil()) => () case (RunnableNil(), RunnableNil()) => ()
} }
def main(): Unit = { //z3 finds counterexample in 0.5
//cvc4 needs 130 seconds
def main(): Int = {
val state = SharedState(0) val state = SharedState(0)
val t1 = RunnableCons((s: SharedState) => s.i = s.i + 1, RunnableNil()) val t1 = RunnableCons((s: SharedState) => s.i = s.i + 1, RunnableNil())
val t2 = RunnableCons((s: SharedState) => s.i = s.i * 2, RunnableNil()) val t2 = RunnableCons((s: SharedState) => s.i = s.i * 2, RunnableNil())
execute(t1, t2, state) execute(t1, t2, state)
assert(state.i == 2) state.i
} } ensuring(_ == 2)
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment