Skip to content

Avoid crashing when --dependence-graph is used by correcting namespac… #1682

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
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
11 changes: 7 additions & 4 deletions src/goto-analyzer/goto_analyzer_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,9 @@ void goto_analyzer_parse_optionst::get_command_line_options(optionst &options)
/// For the task, build the appropriate kind of analyzer
/// Ideally this should be a pure function of options.
/// However at the moment some domains require the goto_model
ai_baset *goto_analyzer_parse_optionst::build_analyzer(const optionst &options)
ai_baset *goto_analyzer_parse_optionst::build_analyzer(
const optionst &options,
const namespacet &ns)
{
ai_baset *domain = nullptr;

Expand All @@ -324,7 +326,7 @@ ai_baset *goto_analyzer_parse_optionst::build_analyzer(const optionst &options)
}
else if(options.get_bool_option("dependence-graph"))
{
domain=new dependence_grapht(namespacet(goto_model.symbol_table));
domain=new dependence_grapht(ns);
}
else if(options.get_bool_option("intervals"))
{
Expand All @@ -348,7 +350,7 @@ ai_baset *goto_analyzer_parse_optionst::build_analyzer(const optionst &options)
}
else if(options.get_bool_option("dependence-graph"))
{
domain=new dependence_grapht(namespacet(goto_model.symbol_table));
domain=new dependence_grapht(ns);
}
else if(options.get_bool_option("intervals"))
{
Expand Down Expand Up @@ -611,7 +613,8 @@ int goto_analyzer_parse_optionst::perform_analysis(const optionst &options)

// Build analyzer
status() << "Selecting abstract domain" << eom;
std::unique_ptr<ai_baset> analyzer(build_analyzer(options));
namespacet ns(goto_model.symbol_table); // Must live as long as the domain.
std::unique_ptr<ai_baset> analyzer(build_analyzer(options, ns));

if(analyzer == nullptr)
{
Expand Down
2 changes: 1 addition & 1 deletion src/goto-analyzer/goto_analyzer_parse_options.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class goto_analyzer_parse_optionst:

virtual int perform_analysis(const optionst &options);

ai_baset *build_analyzer(const optionst &options);
ai_baset *build_analyzer(const optionst &, const namespacet &ns);

void eval_verbosity();

Expand Down