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

Re: [csmith-dev] Using Generic sizeof() operator instead of hard quoted values for return values of datatypes

sameeran joshi <gsocsameeran@gmail.com> writes:

> In the following code,
> unsigned long Type::SizeInBytes(void) const
> [...]
> in {SOURCE CODE}/src/Types.cpp  of clone of Csmith's git repo,
> returns hard quoted values of the sizes of the data types which could
> differ for various architectures.
> Is it ok to change it to return  sizeof(DATA TYPE)?

For some datatypes, sizeof(...) may be different for different compilers.

(Whether or not this is true in practice, it is true in principle.)

If you made the change that you propose, it is possible that, for a particular
input --- meaning a particular random seed and the set of command-line inputs
--- Csmith would output different programs when it is compiled with different
compilers.  Does that make sense?

We want Csmith to be *deterministic* in its input.  In other words, no matter
how Csmith compiled, the output that you get from Csmith should depend only on
the input that you give to it.  This property makes it possible for somebody to
recreate the output of Csmith (i.e., the program that it generated) by knowing
only (1) the version of Csmith that was used and (2) the input that was given
to Csmith.

You might have noticed that we output (1) and (2) at the top of every program
created by Csmith.

Does all that make sense?


Eric Eide <eeide@cs.utah.edu>  .         University of Utah School of Computing
http://www.cs.utah.edu/~eeide/ . +1 (801) 585-5512 voice, +1 (801) 581-5843 FAX