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

Re: [csmith-dev] arthur's bugs



Hi Arthur,

Arthur O'Dwyer wrote:
On Fri, Apr 29, 2011 at 12:10 PM, John Regehr <regehr@cs.utah.edu> wrote:
Thanks for the details, Arthur!

It sounds like your process is working well.  If you are going to test GCC
in this fashion, I may focus our CPU cycles in a LLVM for the time being.
 I'm just not finding a lot wrong with GCC these days, for the first time in
several years (I wonder if others besides you are running Csmith?).

Your reduction process sounds good-- perhaps we can use these tricks in an
automated reducer.

Oh, definitely.

By the way, I've been wondering about your original motivation for
printing only a final checksum, rather than inserting calls to
printf() throughout the program. Was it just the most obvious way to
avoid winding up with a printf() inside an infinite loop? One of the
first code changes to Csmith that I would investigate would be to
insert printf("%appropriate-specifier", arbitrary-complex-expression)
at random points in the generated code. If an infinite amount of
output worries you, then you could always do something like
    #define printf if (global_counter < 1000) global_counter++, printf
at the top of the file.  (Untested. I bet the above wouldn't work in
gcc's C99 mode because printf is already a macro. But you get the
general idea.)


Another thing is that we've seen cases where printf prevented compilers from doing aggressive optimizations, and hence reduced the change we could find these bugs.

For example, like the simple code below, the printf between two assignments disallowed the dead store elimination on " g = 1".

int g;
void foo(void)
{
   g = 1;
   printf("g = %d\n", g);
   g = 2;
}

- Yang