Does anyone know a random generator of C programs that include floating-point computations?
I am looking for something that would be a little bit like Csmith, except that Csmith does not generate floating-point expressions, and that it generates tons of other constructs, making it a little difficult to modify. Generating sequential computations would be a good start for my purpose as long as these included some floating-point ones. Conditionals would be even better, but I wouldn't need loops, pointers, or even arrays.
Since so many languages use a C-like syntax, such a generator may not have to be specific to C. Even if it's specific to another C-like language, I might be able to text-process a generated program for that language into a C program.
EDIT: here is a snippet of a Csmith-generated program to clarify what I am looking for.
...
int64_t *l_374 = &g_189;
int32_t l_375 = (-1L);
int i, j, k;
l_375 &= ((g_106 == ((*l_374) = (&g_324[4] == l_373[0][0][5]))) < 0x80C8L);
return (*g_207);
...
I should also clarify that while taking a Csmith program and substituting, say, int64_t
with float
may give a syntactically correct C program, it will almost certainly not give a defined program. I can test whether a substituted program contains undefined behavior, but this is not cheap, and if I have to reject 99% of substituted programs because they are undefined, the process will be too slow to be useful.