spcl / perf-taint

Taint-based program analysis framework for empirical performance modeling.
BSD 3-Clause "New" or "Revised" License
5 stars 2 forks source link

Loop instrumentation fails for while(true) loops #26

Closed larissaschmid closed 3 years ago

larissaschmid commented 3 years ago

In the loop instrumentation, the assertion that the condition of a branch is an instruction fails for while(true) loops.

mcopik commented 3 years ago

@julifan Unfortunately, I didn't succeed in reproducing the issue. Do you happen to have an MWE? Perhaps there was a different exit condition in your loop?

See the unit test: https://github.com/spcl/perf-taint/blob/master/tests/unit/dataflow/while_loop.cpp#L32

larissaschmid commented 3 years ago

I've looked up the loop again, and actually it is a do {} while(true) loop, as in this minimal example, where the assertion also fails:


#include <stdio.h>
#include <stdlib.h>
#include <perf-taint/PerfTaint.h>

int x1 EXTRAP;

void f(int x1) 
{
  int myVar = 0;
  do {
    myVar += 1;
    if (myVar > 100) break;
  } while (true);
}

int main(int argc, char ** argv)
{
    x1 = atoi(argv[1]);
    perf_taint_register_variable(&x1, sizeof(x1), VARIABLE_NAME(x1));

    f(x1);

} 
mcopik commented 3 years ago

@julifan The issue should be now fixed on master.