Skip to content

Commit 22b9203

Browse files
authored
Fix svcomp assert (#779)
Moved replacement of error_reach with assert false into preprocessing We needed this so that we can run SVCOMP benchmarks without setting verifier option to SVCOMP.
1 parent f2d55f3 commit 22b9203

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

share/smack/svcomp/utils.py

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,25 +69,13 @@ def force_timeout():
6969
sys.stdout.flush()
7070
time.sleep(1000)
7171

72-
def inject_assert_false(args):
73-
with open(args.bpl_file, 'r') as bf:
74-
content = bf.read()
75-
content = content.replace('call reach_error();', 'assert false; call reach_error();')
76-
with open(args.bpl_file, 'w') as bf:
77-
bf.write(content)
78-
7972
def verify_bpl_svcomp(args):
8073
"""Verify the Boogie source file using SVCOMP-tuned heuristics."""
8174
heurTrace = "\n\nHeuristics Info:\n"
8275

8376
from smack.top import VProperty
8477
from smack.top import VResult
8578

86-
if not (VProperty.MEMORY_SAFETY in args.check
87-
or VProperty.MEMLEAK in args.check
88-
or VProperty.INTEGER_OVERFLOW in args.check):
89-
inject_assert_false(args)
90-
9179
# Setting good loop unroll bound based on benchmark class
9280
loopUnrollBar = 13
9381
time_limit = 880

share/smack/top.py

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -777,6 +777,7 @@ def llvm_to_bpl(args):
777777
try_command(cmd, console=True)
778778
annotate_bpl(args)
779779
memsafety_subproperty_selection(args)
780+
replace_reach_error(args)
780781
transform_bpl(args)
781782

782783

@@ -841,6 +842,25 @@ def replace_assertion(m):
841842
f.write(line)
842843

843844

845+
def replace_reach_error(args):
846+
"""Replaces calls to reach_error in SVCOMP benchmarks with assert false."""
847+
848+
if args.language != 'svcomp':
849+
return
850+
851+
if (VProperty.MEMORY_SAFETY in args.check or
852+
VProperty.MEMLEAK in args.check or
853+
VProperty.INTEGER_OVERFLOW in args.check):
854+
return
855+
856+
with open(args.bpl_file, 'r') as bf:
857+
content = bf.read()
858+
content = content.replace('call reach_error();',
859+
'assert false; call reach_error();')
860+
with open(args.bpl_file, 'w') as bf:
861+
bf.write(content)
862+
863+
844864
def transform_bpl(args):
845865
if args.transform_bpl:
846866
with open(args.bpl_file, 'r+') as bpl:
@@ -991,9 +1011,8 @@ def verify_bpl(args):
9911011

9921012
elif args.verifier == 'corral':
9931013
command = corral_command(args)
994-
args.verifier_options += (
995-
" /bopt:proverOpt:O:smt.qi.eager_threshold=100"
996-
" /bopt:proverOpt:O:smt.arith.solver=2")
1014+
command += ["/bopt:proverOpt:O:smt.qi.eager_threshold=100"]
1015+
command += ["/bopt:proverOpt:O:smt.arith.solver=2"]
9971016

9981017
elif args.verifier == 'symbooglix':
9991018
command = symbooglix_command(args)

0 commit comments

Comments
 (0)