Skip to content

SYNTHESIZER: Add an option to specify object bits in synthesizer #7606

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions doc/man/goto-synthesizer.1
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@ resulting program as GOTO binary on disk.
.SH OPTIONS
.TP
\fB\-loop\-contracts\-no\-unwind\fR
Do not unwind transformed loops after applying the synthesized loop contracts.
do not unwind transformed loops after applying the synthesized loop contracts
.TP
\fB\-\-dump\-loop\-contracts
Dump the synthesized loop contracts as JSON.
dump the synthesized loop contracts as JSON
.TP
\fB\-\-json-\output\fR \fIfile\fR
Specify the output destination of the loop-contracts JSON.
specify the output destination of the loop-contracts JSON
.SS "Backend options:"
.TP
\fB\-\-object\-bits\fR n
number of bits used for object addresses
.SS "User-interface options:"
.TP
\fB\-\-xml\-ui\fR
Expand Down
20 changes: 20 additions & 0 deletions regression/goto-synthesizer/address_space_size_limit/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <assert.h>
#include <stdlib.h>

int main()
{
int i;
char *a;
char *b;
char *c;
a = (char *)malloc(1);
b = (char *)malloc(1);
c = (char *)malloc(1);
for(i = 0; i < 5; ++i)
{
*a = 0;
*b = 0;
*c = 0;
}
assert(*c + *b + *c == 1);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c
--pointer-check _ --object-bits 1
too many addressed objects
^EXIT=6$
^SIGNAL=0$
--
Check if the synthesizer can correctly set object bits when calling CBMC.
2 changes: 1 addition & 1 deletion regression/goto-synthesizer/chain.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ echo "Running goto-synthesizer: "
if echo $args_synthesizer | grep -q -- "--dump-loop-contracts" ; then
$goto_synthesizer ${args_synthesizer} "${name}-mod.gb"
else
$goto_synthesizer "${name}-mod.gb" "${name}-mod-2.gb"
$goto_synthesizer ${args_synthesizer} "${name}-mod.gb" "${name}-mod-2.gb"
echo "Running CBMC: "
$cbmc "${name}-mod-2.gb"
fi
4 changes: 3 additions & 1 deletion src/goto-synthesizer/goto_synthesizer_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Author: Qinheping Hu

#include "goto_synthesizer_parse_options.h"

#include <util/config.h>
#include <util/exit_codes.h>
#include <util/version.h>

Expand Down Expand Up @@ -196,6 +195,9 @@ void goto_synthesizer_parse_optionst::help()
HELP_DUMP_LOOP_CONTRACTS
HELP_LOOP_CONTRACTS_NO_UNWIND
"\n"
"Backend options:\n"
HELP_CONFIG_BACKEND
"\n"
"Other options:\n"
" --version show version and exit\n"
" --xml-ui use XML-formatted output\n"
Expand Down
2 changes: 2 additions & 0 deletions src/goto-synthesizer/goto_synthesizer_parse_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Author: Qinheping Hu
#ifndef CPROVER_GOTO_SYNTHESIZER_GOTO_SYNTHESIZER_PARSE_OPTIONS_H
#define CPROVER_GOTO_SYNTHESIZER_GOTO_SYNTHESIZER_PARSE_OPTIONS_H

#include <util/config.h>
#include <util/parse_options.h>

#include <goto-programs/goto_model.h>
Expand All @@ -21,6 +22,7 @@ Author: Qinheping Hu
#define GOTO_SYNTHESIZER_OPTIONS \
OPT_DUMP_LOOP_CONTRACTS \
"(" FLAG_LOOP_CONTRACTS_NO_UNWIND ")" \
OPT_CONFIG_BACKEND \
"(verbosity):(version)(xml-ui)(json-ui)" \
// empty last line

Expand Down