Skip to content

Commit

Permalink
accept unreliable safe config option
Browse files Browse the repository at this point in the history
  • Loading branch information
csanadtelbisz committed Oct 18, 2024
1 parent 58b9204 commit d873017
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,6 @@ class XcfaOcChecker(

private fun exit(msg: String): Nothing {
System.err.println(msg)
exitProcess(203)
error(203)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,14 @@ fun frontend(config: XcfaConfig<*, *>, logger: Logger, uniqueLogger: Logger): Tr

logger.write(
Logger.Level.INFO, "Frontend finished: ${xcfa.name} (in ${
stopwatch.elapsed(TimeUnit.MILLISECONDS)
} ms)\n"
stopwatch.elapsed(TimeUnit.MILLISECONDS)
} ms)\n"
)

// logger.write(RESULT, "ParsingResult Success\n")
logger.write(RESULT, "ParsingResult Success\n")
logger.write(RESULT,
"Alias graph size: ${xcfa.pointsToGraph.size} -> ${xcfa.pointsToGraph.values.map { it.size }.toList()}\n")
"Alias graph size: ${xcfa.pointsToGraph.size} -> ${xcfa.pointsToGraph.values.map { it.size }.toList()}\n"
)

return Triple(xcfa, mcm, parseContext)
}
Expand Down Expand Up @@ -217,8 +218,8 @@ private fun backend(
when {
result.isSafe && LoopUnrollPass.FORCE_UNROLL_USED -> { // cannot report safe if force unroll was used
logger.write(RESULT, "Incomplete loop unroll used: safe result is unreliable.\n")
//SafetyResult.unknown<EmptyWitness, EmptyCex>() // for comparison with BMC tools
result
if (config.outputConfig.acceptUnreliableSafe) result // for comparison with BMC tools
else SafetyResult.unknown<EmptyWitness, EmptyCex>()
}

else -> result
Expand All @@ -227,8 +228,8 @@ private fun backend(

logger.write(
Logger.Level.INFO, "Backend finished (in ${
stopwatch.elapsed(TimeUnit.MILLISECONDS)
} ms)\n"
stopwatch.elapsed(TimeUnit.MILLISECONDS)
} ms)\n"
)

logger.write(RESULT, result.toString() + "\n")
Expand Down Expand Up @@ -332,8 +333,10 @@ private fun postVerificationLogging(
traceFile.writeText(GraphvizWriter.getInstance().writeString(traceG))

val sequenceFile = File(resultFolder, "trace.plantuml")
writeSequenceTrace(sequenceFile,
safetyResult.asUnsafe().cex as Trace<XcfaState<ExplState>, XcfaAction>) { (_, act) ->
writeSequenceTrace(
sequenceFile,
safetyResult.asUnsafe().cex as Trace<XcfaState<ExplState>, XcfaAction>
) { (_, act) ->
act.label.getFlatLabels().map(XcfaLabel::toString)
}

Expand Down Expand Up @@ -364,8 +367,10 @@ private fun postVerificationLogging(
}
}

private fun writeSequenceTrace(sequenceFile: File, trace: Trace<XcfaState<ExplState>, XcfaAction>,
printer: (Pair<XcfaState<ExplState>, XcfaAction>) -> List<String>) {
private fun writeSequenceTrace(
sequenceFile: File, trace: Trace<XcfaState<ExplState>, XcfaAction>,
printer: (Pair<XcfaState<ExplState>, XcfaAction>) -> List<String>
) {
sequenceFile.writeText("@startuml\n")
var maxWidth = 0
trace.actions.forEachIndexed { i, it ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,9 @@ data class OutputConfig(
@Parameter(names = ["--output-directory"], description = "Specify the directory where the result files are stored")
var resultFolder: File = Paths.get("./").toFile(),

@Parameter(names = ["--accept-unreliable-safe"], description = "Accept safe results even with unsafe loop unroll")
var acceptUnreliableSafe: Boolean = false,

val cOutputConfig: COutputConfig = COutputConfig(),
val xcfaOutputConfig: XcfaOutputConfig = XcfaOutputConfig(),
val chcOutputConfig: ChcOutputConfig = ChcOutputConfig(),
Expand Down

0 comments on commit d873017

Please sign in to comment.