Skip to content

Commit 7f14ebb

Browse files
author
martin
committed
Make the call to rewrite-union configurable
Rewrite union converts union member access to byte extracts. This is (apparently) good for CBMC and goto-diff but it makes analysis harder for goto-analyzer. So to make them consistent we add an option which controls whether it is run or not. This is fixed in each tool but it takes us closer to common processing of goto programs.
1 parent b316da9 commit 7f14ebb

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/cbmc/cbmc_parse_options.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,9 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
531531
options.set_option("show-points-to-sets", true);
532532

533533
PARSE_OPTIONS_GOTO_TRACE(cmdline, options);
534+
535+
// Options for process_goto_program
536+
options.set_option("rewrite-union", true);
534537
}
535538

536539
/// invoke main modules
@@ -958,7 +961,8 @@ bool cbmc_parse_optionst::process_goto_program(
958961
remove_returns(goto_model);
959962
remove_vector(goto_model);
960963
remove_complex(goto_model);
961-
rewrite_union(goto_model);
964+
if(options.get_bool_option("rewrite-union"))
965+
rewrite_union(goto_model);
962966

963967
// add generic checks
964968
log.status() << "Generic Property Instrumentation" << messaget::eom;

src/goto-analyzer/goto_analyzer_parse_options.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ Author: Daniel Kroening, [email protected]
4141
#include <goto-programs/remove_returns.h>
4242
#include <goto-programs/remove_vector.h>
4343
#include <goto-programs/remove_virtual_functions.h>
44+
#include <goto-programs/rewrite_union.h>
4445
#include <goto-programs/set_properties.h>
4546
#include <goto-programs/show_properties.h>
4647
#include <goto-programs/show_symbol_table.h>
@@ -610,6 +611,7 @@ int goto_analyzer_parse_optionst::doit()
610611

611612
// Perserve backwards compatability in processing
612613
options.set_option("partial-inline", true);
614+
options.set_option("rewrite-union", false);
613615

614616
if(process_goto_program(options))
615617
return CPROVER_EXIT_INTERNAL_ERROR;
@@ -919,6 +921,8 @@ bool goto_analyzer_parse_optionst::process_goto_program(
919921
remove_returns(goto_model);
920922
remove_vector(goto_model);
921923
remove_complex(goto_model);
924+
if(options.get_bool_option("rewrite-union"))
925+
rewrite_union(goto_model);
922926

923927
#if 0
924928
// add generic checks

src/goto-diff/goto_diff_parse_options.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,9 @@ void goto_diff_parse_optionst::get_command_line_options(optionst &options)
169169
}
170170

171171
options.set_option("show-properties", cmdline.isset("show-properties"));
172+
173+
// Options for process_goto_program
174+
options.set_option("rewrite-union", true);
172175
}
173176

174177
/// invoke main modules
@@ -313,7 +316,8 @@ bool goto_diff_parse_optionst::process_goto_program(
313316
remove_returns(goto_model);
314317
remove_vector(goto_model);
315318
remove_complex(goto_model);
316-
rewrite_union(goto_model);
319+
if(options.get_bool_option("rewrite-union"))
320+
rewrite_union(goto_model);
317321

318322
// add generic checks
319323
log.status() << "Generic Property Instrumentation" << messaget::eom;

0 commit comments

Comments
 (0)