[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [csmith-bugs] Infinite loops in generated csmith code
Stanley Tzeng <stzeng@nvidia.com> writes:
> Hello CSmith Developers:
Hi!
> I’ve been using your tool and I’ve found two cases where CSmith generated
> code with for loops that would run forever (or, at least until int overflowed
> and then some more). It seems like this might be a bug in the loop
> generation. I’ve attached the testcases as test1.c and test2.c for your
> reference.
Thank you for your report!
Yes, Csmith does sometimes generate loops that do not terminate. The reason
for this is explained in our paper about Csmith:
"It is not difficult to generate random programs that always terminate.
However, we judged that this would limit Csmith’s expressiveness too
much: for example, it would force loops to be highly structured.
Additionally, always-terminating tests cannot find compiler bugs that
wrongfully terminate a non-terminating program. (We have found bugs of
this kind.) About 10% of the programs generated by Csmith are
(apparently) non-terminating. In practice, during testing, they are
easy to deal with using timeouts."
You can find this paper online, <http://www.flux.utah.edu/paper/yang-pldi11>.
> Is there some way to force the compiler to only generate loop increments of
> ++ or --? That would be a quick workaround to this problem.
I don't believe that we ever implemented a Csmith feature like that, but that's
an interesting idea!
Thanks ---
Eric.
--
-------------------------------------------------------------------------------
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