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

Re: [csmith-dev] Zero Checksum

Perhaps the larger problem here is that Csmith produces many programs that are small and (worse) effectively identical.

My early driver scripts kept a hash of every tested program to avoid testing duplicates, but eventually I realized it was simpler and more effective to just throw away every program smaller than some size. We've variously used numbers like 5 KB and 20 KB.

At some level it would be nice if Csmith just failed to produce these programs, but on the other hand I strongly believe in keeping complexity outside of Csmith when this is feasible (I'm not claiming we've done a good job with this).


On 9/2/11 8:43 AM, Eric Eide wrote:
"Paulo" == Paulo J Matos<Paulo.Matos@csr.com>  writes:

	Paulo>  I am slightly concerned with this example:
	Paulo>  $ csmith -v
	Paulo>  csmith 2.1.0
	Paulo>  Git version: e65d3c7
	Paulo>  $ csmith -s 791373680 --no-argc --no-math64 --no-longlong --checksum>
	Paulo>  test.c
	Paulo>  $ gcc -o test -I../../../../local/csmith-runtime/ test.c
	Paulo>  $ ./test
	Paulo>  checksum = 0
	Paulo>  I have seen a couple of seeds with a checksum result equal to
	Paulo>  zero.  This creates some concern about it. Either the checksum
	Paulo>  is indeed zero and it is a bad checksum algorithm, or it is not
	Paulo>  the checksum and there's a bug somewhere which might be
	Paulo>  multiplying the checksum by zero.

I reproduced this.  When I run the generated program, the output checksum is

Looking at the generated program, one can see that it does almost nothing and
has no globals.  Given this, I'm not surprised that the checksum is zero.

I don't agree that a checksum algorithm that sometimes outputs zero is bad.
Especially when it is asked to checksum no data.

	Paulo>  Also, I would expect the checksum to be always of the format:
	Paulo>  checksum = [A-F0-9]{4}
	Paulo>  Any other format hints at a bug. So if this checksum is indeed
	Paulo>  zero. Can you please output it as
	Paulo>  checksum = 0000
	Paulo>  ?

Why do expect that the checksum would be output as a four-digit hex value?
Would doing this make it easier for some other tool to parse or store or...?

I don't agree that outputting the checksum in base 10 hints at a bug.  It may
be less convenient for some application, but I'm not sure what application you
might have in mind.

Thanks ---