[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[csmith-project/creduce] 6ca9db: added a new transformation expression-detector



  Branch: refs/heads/master
  Home:   https://github.com/csmith-project/creduce
  Commit: 6ca9dbfaabdd0669492eb74fbd3c3696171ff340
      https://github.com/csmith-project/creduce/commit/6ca9dbfaabdd0669492eb74fbd3c3696171ff340
  Author: Yang Chen <chenyang@cs.utah.edu>
  Date:   2016-07-21 (Thu, 21 Jul 2016)

  Changed paths:
    M clang_delta/CMakeLists.txt
    A clang_delta/ExpressionDetector.cpp
    A clang_delta/ExpressionDetector.h
    M clang_delta/Makefile.am
    M clang_delta/Makefile.in

  Log Message:
  -----------
  added a new transformation expression-detector

The pass is currently enabled for only C programs. It
inserts a printf statement to print out the value of an expression
based on the counter. Currently, only expressions of type integer and
floating point are considered valid. This pass also injects a
static variable to ensure that the expression of interest will
be printed only once.

Transformation is forbidden on some cases such as lifting the sub-expression
of an addrof operator or an increment operator, because we want to avoid
changing the program's outcome as much as possible. For example, consider
the following statements:
  a = &b;
  *a = 1;

The transformation will not generate output such as:

  int __creduce_expr_tmp = b;
  ...
  a = &__creduce_expr_tmp;
  *a = 1;

If we allow such transformation on b, we would end up assigning
"1" to __creduce_expr_tmp rather than "b", and hence change
the program's outcome.

Another note is that the pass has some optimization to reduce
the number of valid instances. For example, for the given code below:

  int a[5] = {b[1], b[1], b[1], b[1], b[1]};

We don't need to lift all "b[1]". Lifting only one "b[1]" is enough.

Furthermore, the pass avoids repeatly rewriting temp vars such as
__creduce_tmp_xxx.

Note that to work with Csmith, it's better to pass preprocessed programs
to this pass. Currently, C-Reduce doesn't provide a way for specifying
search paths for header files. If we feed the pass a Csmith-generated program
without preprocessing, we won't have many valid transformation instances
because almost all statements are broken due to the miss of the definitions
of int_8, int_16 etc.


  Commit: 8d77616303294cee8caed1399264e7b8edc1d18f
      https://github.com/csmith-project/creduce/commit/8d77616303294cee8caed1399264e7b8edc1d18f
  Author: Yang Chen <chenyang@cs.utah.edu>
  Date:   2016-07-21 (Thu, 21 Jul 2016)

  Changed paths:
    M clang_delta/ExpressionDetector.cpp
    M clang_delta/ExpressionDetector.h

  Log Message:
  -----------
  Fixed an issue of lifting LHS of a binary operator

* Unify the local process of visiting UO and BO for a statement.

* also avoid lifting the LHS of a binary opeartor


Compare: https://github.com/csmith-project/creduce/compare/8cb378e28eb6...8d7761630329