SVF-tools / Test-Suite

PTABen: Micro-benchmark Suite for Pointer Analysis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Non-terminating recursive call before assertions in `cs_tests/recur10.c`

taquangtrung opened this issue · comments

Hi,

For this test case, the first recursive call to f() inside the body of f will be non-terminating.

So, I wonder if it is OK to check alias information after this call?
Such assertions will never be reached anyway.

// cs_tests/recur10.c

#include "aliascheck.h"
int **p,*x, y, z;

void f() {
  p = &x;
  if (1) {
    *p = &y;
	MUSTALIAS(x,&y);
    f();
    *p = &z;
	/// p doesn't point to x at the above line: although p's
	/// value changed by stmt "p=&x", the value flow can not
	/// reach "*p=&z" since it will flow into f() before
	/// "*p=&z" and connected with the entry of f(). So the
	/// store "*p=&z" can not be completed as p's pts is empty.
	NOALIAS(x,&z);
	NOALIAS(x,&y);
    f();
  }
}

int main()
{
    f();
    return 0;
}

Yes, correct. I guess the reason might because the test case writer was not considering path sensitivity (branch conditions). I am changing the if condition to make it terminable.

Thank you for the update!

Hi,

Do you have any updates for this test case?

Is it possible to change the condition if (1) to something like if (z)? I saw that if (z) is also used by the other test case recur4.c

Added the base case: 60848d6

Thank you for the quick update! I also notice the same issue in recur0.c

void f() {
  if (1) {
    x = &y;
    MUSTALIAS(x, &y)
    f();
    x = &z;
    MUSTALIAS(x, &z)
    NOALIAS(x, &y)
    f();
  }
}