Hello Shafiul,
I can't think of a really easy way to make this happen. Perhaps you can hack Csmith a bit so that it generates initializers in a function that runs at the start of main, instead of running at initializer time.
John
On 08/03/2016 09:28 AM, Shafiul Azam wrote:
Thank you!Hi All,I'm trying to use Csmith in my project where I dynamically link Csmith generated code. The Csmith generated main function is called repeatedly up to a certain number of times. Now, when the main function is called second (or third, fourth etc.) time, global variables have values different than their initial values (as a result of the computations performed when main was called first time). As a result, the program behaviors differently (different checksum, crashes etc.).
Is there any way to reset values of the global variables before main is called, so that, if I dynamically link a Csmith generated function and call it multiple times, it would have produced same behaviors (checksum) each time? Or, at least, should not exhibit any unspecified or undefined behaviors?
Shafiul