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

Re: [csmith-project/csmith] 7d6fae: add prefix/suffix ++/--



Nice.

The code looks really evil now!

To get ++ and -- for full-width types, how about a macro like this?

  #define PP(x) ((x==INT_MAX)?x:x++)

John





On 7/14/11 1:44 PM, Xuejun Yang wrote:
   Branch: refs/heads/master
   Home:   https://github.com/csmith-project/csmith

   Commit: 7d6fae96cc710e65513ea4822f9d3c721748a2d0
       https://github.com/csmith-project/csmith/commit/7d6fae96cc710e65513ea4822f9d3c721748a2d0
   Author: Xuejun Yang<jxyang@cs.utah.edu>
   Date:   2011-07-14 (Thu, 14 Jul 2011)

   Changed paths:
     M src/CGOptions.cpp
   M src/CGOptions.h
   M src/CVQualifiers.cpp
   M src/Constant.cpp
   M src/Expression.cpp
   M src/Expression.h
   M src/Lhs.cpp
   M src/Lhs.h
   M src/Probabilities.cpp
   M src/Probabilities.h
   M src/StatementAssign.cpp
   M src/StatementAssign.h
   M src/Type.cpp
   M src/Type.h

   Log Message:
   -----------
   add prefix/suffix ++/--

1) emit ++/-- operators as either prefix or suffix when there is no risk of signed integer overflow. That means the variable that is incremented/decremented is either unsigned, or has a width<  INT_SIZE. INT_SIZE is 4 bytes by default, and can be configured

2) add "(void*)" before "0" to indicate a null pointer. This gets rid of the gcc warnings like: "assignment makes pointer from integer without a cast", and "passing argument 1 of 'func_20' makes pointer from integer without a cast"

3) kill another gcc warning that is caused by dropped qualifiers from LHS of an embedded assignments

4) replace StatementAssignFilter with a VectorFilter. It's a pain to maintain so many specialized filters.

5) clean up the code that initializes probability tables