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

[csmith-dev] wishlist: option to disable globals

Hi! John Regehr said I should bring this up here: I'd like to have a
csmith option to not generate or use global variables, or at least to
generate only read-only globals. Any chance someone feels like
implementing that?

For context--I'm trying my hand at writing a C to Rust translator (in
Haskell, because the project needed more languages):


It occurred to me that csmith could be a perfect tool for testing this
project. My implementation isn't complete enough to handle any
csmith-generated programs at all yet, but at some point I'm hoping to
compare the output of running csmith programs compiled with GCC or
clang against the same programs translated with my tool and then
compiled with rustc.

However, Rust strongly discourages global mutable variables, and I'd
rather not think about generating "unsafe" blocks or some other
solution for a while. So I'm hoping to limit the output from csmith
instead until I'm ready to deal with that level of complexity. Most of
the other language features that I haven't implemented yet already
have csmith options, which is great!