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

Re: [csmith-dev] Program Hangs



Hi Haihao,

As Yang says, we just use timeouts to kill non-terminating Csmith output.

It's not hard to generate programs that always terminate, for example by suppressing backwards gotos and loops that modify the induction variable in unstructured ways. But we haven't felt that this was desirable. We could add it to our todo list if it would be useful for you. Is there some reason that timeouts are not acceptable?

I'll add that even if we eliminate infinite loops, some random programs that contain nested loops with 32-bit and 64-bit induction variables will run effectively forever. So you would need timeouts anyway, unless we further modified Csmith to ensure not only termination, but also rapid termination.

John






On 04/27/2011 12:49 AM, Yang Chen wrote:
Hi Haihao,

On 4/27/2011 12:27 AM, haihao shen wrote:
Hi,

I used CSmith to generate random code. However, some programs will hang
with the command "./a.out" (The attachment is an example.) while others
will correctly print the checksum.

I am not sure whether there is some other configures to let the program
print the checksum correctly each time.

Unfortunately, no. We feel that it could limit the expressiveness of our
generator if we made all randomly generated programs terminate. It's
easy to deal with the termination problem. You could set up timeout when
you are running any executable. For instance, you might want to use this
tool:

http://www.gnu.org/software/coreutils/manual/html_node/timeout-invocation.html


Our test driver scripts/compiler_test.pl shows how to use timeout to
stop execution.

- Yang


Or, could you tell me how I could generate those kind of programs?

Thanks for your help!

Best,
Haihao