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

Re: [csmith-dev] How to generate fixed size program using Csmith

Eric's answer is excellent and I'll just add that since Csmith programs often contain quite a bit of dead code, you may (depending on your goals) prefer to generate programs that contain a specified amount of live code.


On 11/6/18 8:30 AM, Eric Eide wrote:
shijun zhao <zqyzsj@gmail.com> writes:

Is there any way for Csmith to generate programs whose size (or the
lines of code) can be specified? Thanks.

Hi!  No, there is no option that sets the exact size of the generated program.

There are options that influence the possible (maximum) size of the generated
programs.  These include:


If you set these values higher, the generated programs can be bigger.

The easiest way to generate programs in a particular size range is simply to
generate a lot of programs and discard the ones that don't fall into the size
range you want.

Warning: If you have a very narrow range, you might have to run Csmith many,
many times to get the total number of programs that you want!  My advice is to
not make your ranges too narrow.  "Exactly 100K" is bad; "between 90K and 110K"
is better.

Happy hacking! ---