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

Re: [csmith-bugs] checksum computation, --no-longlong, and 32 vs 64 bits

Hi Xavier,

I apologize for the duplicated message you received. I forgot to reply to the list.

On 7/31/11 10:31 AM, Xavier Leroy wrote:
Dear Csmith developers,

I'm running Csmith on a x86-64 platform and running the output with
gcc (64 bits), gcc -m32 (32 bits), and CompCert (32 bits).

For a while I was very worried that CompCert-generated code reported
different checksums than gcc.  Then I understood that different
checksum algorithms are used with CompCert and with gcc.

I'd like to offer the following suggestions:

1- In --ccomp mode, always generate


before #include "csmith.h", so that even if the output is compiled
with gcc, a 32-bit checksum will be computed.

Same goes for SPLAT mode?  (whatever that is).
When I tested CompCert, I pass to CompCert and gcc an extra flag, -D__COMPCERT__, which force the tested compilers to use the same checksum computing function.
2- In -no-longlong mode, do not generate

#ifndef __x86_64__

but do generate


(Why single out x86_64???)

Another, more radical suggestions would be to have two functions

crc32_4bytes (uint32_t val)
crc32_8bytes (uint64_t val)   (only #ifndef NO_LONGLONG)

and call crc32_4bytes for all variables of type 32 bit or smaller
and call crc32_8bytes only for variables of type 64 bit int.

Yes. Thanks for these suggestions. I will make the change.
That was the last message in the series.  Thanks for your patience,
and for an amazing piece of software.

- Xavier