Skip to content

Fix copy&paste error in same_set #1626

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 2 commits into from
Nov 28, 2017
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
13 changes: 13 additions & 0 deletions regression/goto-instrument/show-escape-analysis1/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <stdlib.h>

void foo()
{
int *leaked1=malloc(sizeof(int));
int *leaked2=malloc(sizeof(int));
}

int main()
{
foo();
return 0;
}
11 changes: 11 additions & 0 deletions regression/goto-instrument/show-escape-analysis1/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
CORE
main.c
--show-escape-analysis
^EXIT=0$
^SIGNAL=0$
^Aliases:.*(malloc.*leaked|leaked.*malloc)
--
^Aliases:.*(leaked1.*leaked2|leaked1.*leaked2)
^warning: ignoring
--
leaked1 and leaked2 cannot alias
12 changes: 2 additions & 10 deletions src/analyses/escape_analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -305,16 +305,8 @@ bool escape_domaint::merge(
locationt from,
locationt to)
{
if(b.has_values.is_false())
return false; // no change

if(has_values.is_false())
{
*this=b;
return true; // change
}

bool changed=false;
bool changed=has_values.is_false();
has_values=tvt::unknown();

for(const auto &cleanup : b.cleanup_map)
{
Expand Down
2 changes: 1 addition & 1 deletion src/util/union_find.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ class union_find final
bool same_set(const T &a, const T &b) const
{
const optionalt<number_type> na = numbers.get_number(a);
const optionalt<number_type> nb = numbers.get_number(a);
const optionalt<number_type> nb = numbers.get_number(b);

if(na && nb)
return uuf.same_set(*na, *nb);
Expand Down