Skip to content

Commit 42c350e

Browse files
authored
Merge pull request #7606 from qinheping/object_bits_in_synthesizer
SYNTHESIZER: Add an option to specify object bits in synthesizer
2 parents 7c95385 + 60ff9d9 commit 42c350e

File tree

6 files changed

+41
-5
lines changed

6 files changed

+41
-5
lines changed

doc/man/goto-synthesizer.1

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,17 @@ resulting program as GOTO binary on disk.
1818
.SH OPTIONS
1919
.TP
2020
\fB\-loop\-contracts\-no\-unwind\fR
21-
Do not unwind transformed loops after applying the synthesized loop contracts.
21+
do not unwind transformed loops after applying the synthesized loop contracts
2222
.TP
2323
\fB\-\-dump\-loop\-contracts
24-
Dump the synthesized loop contracts as JSON.
24+
dump the synthesized loop contracts as JSON
2525
.TP
2626
\fB\-\-json-\output\fR \fIfile\fR
27-
Specify the output destination of the loop-contracts JSON.
27+
specify the output destination of the loop-contracts JSON
28+
.SS "Backend options:"
29+
.TP
30+
\fB\-\-object\-bits\fR n
31+
number of bits used for object addresses
2832
.SS "User-interface options:"
2933
.TP
3034
\fB\-\-xml\-ui\fR
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#include <assert.h>
2+
#include <stdlib.h>
3+
4+
int main()
5+
{
6+
int i;
7+
char *a;
8+
char *b;
9+
char *c;
10+
a = (char *)malloc(1);
11+
b = (char *)malloc(1);
12+
c = (char *)malloc(1);
13+
for(i = 0; i < 5; ++i)
14+
{
15+
*a = 0;
16+
*b = 0;
17+
*c = 0;
18+
}
19+
assert(*c + *b + *c == 1);
20+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--pointer-check _ --object-bits 1
4+
too many addressed objects
5+
^EXIT=6$
6+
^SIGNAL=0$
7+
--
8+
Check if the synthesizer can correctly set object bits when calling CBMC.

regression/goto-synthesizer/chain.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ echo "Running goto-synthesizer: "
4848
if echo $args_synthesizer | grep -q -- "--dump-loop-contracts" ; then
4949
$goto_synthesizer ${args_synthesizer} "${name}-mod.gb"
5050
else
51-
$goto_synthesizer "${name}-mod.gb" "${name}-mod-2.gb"
51+
$goto_synthesizer ${args_synthesizer} "${name}-mod.gb" "${name}-mod-2.gb"
5252
echo "Running CBMC: "
5353
$cbmc "${name}-mod-2.gb"
5454
fi

src/goto-synthesizer/goto_synthesizer_parse_options.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Author: Qinheping Hu
88

99
#include "goto_synthesizer_parse_options.h"
1010

11-
#include <util/config.h>
1211
#include <util/exit_codes.h>
1312
#include <util/version.h>
1413

@@ -196,6 +195,9 @@ void goto_synthesizer_parse_optionst::help()
196195
HELP_DUMP_LOOP_CONTRACTS
197196
HELP_LOOP_CONTRACTS_NO_UNWIND
198197
"\n"
198+
"Backend options:\n"
199+
HELP_CONFIG_BACKEND
200+
"\n"
199201
"Other options:\n"
200202
" --version show version and exit\n"
201203
" --xml-ui use XML-formatted output\n"

src/goto-synthesizer/goto_synthesizer_parse_options.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ Author: Qinheping Hu
99
#ifndef CPROVER_GOTO_SYNTHESIZER_GOTO_SYNTHESIZER_PARSE_OPTIONS_H
1010
#define CPROVER_GOTO_SYNTHESIZER_GOTO_SYNTHESIZER_PARSE_OPTIONS_H
1111

12+
#include <util/config.h>
1213
#include <util/parse_options.h>
1314

1415
#include <goto-programs/goto_model.h>
@@ -21,6 +22,7 @@ Author: Qinheping Hu
2122
#define GOTO_SYNTHESIZER_OPTIONS \
2223
OPT_DUMP_LOOP_CONTRACTS \
2324
"(" FLAG_LOOP_CONTRACTS_NO_UNWIND ")" \
25+
OPT_CONFIG_BACKEND \
2426
"(verbosity):(version)(xml-ui)(json-ui)" \
2527
// empty last line
2628

0 commit comments

Comments
 (0)