{"id":18728867,"url":"https://github.com/rubyonworld/csmith","last_synced_at":"2025-11-12T05:30:21.843Z","repository":{"id":174007885,"uuid":"533346329","full_name":"RubyOnWorld/csmith","owner":"RubyOnWorld","description":"Csmith is a random generator of C programs. It's primary purpose is to find compiler bugs with random programs, using differential testing as the test oracle.","archived":false,"fork":false,"pushed_at":"2022-09-06T13:56:08.000Z","size":9305,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-12-28T14:27:36.644Z","etag":null,"topics":["csmith","generator","primary"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RubyOnWorld.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":null,"funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-06T13:50:43.000Z","updated_at":"2024-11-30T03:16:22.000Z","dependencies_parsed_at":null,"dependency_job_id":"a9f03ea9-3494-4a66-943f-c81e226b7992","html_url":"https://github.com/RubyOnWorld/csmith","commit_stats":null,"previous_names":["rubyonworld/csmith"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyOnWorld%2Fcsmith","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyOnWorld%2Fcsmith/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyOnWorld%2Fcsmith/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RubyOnWorld%2Fcsmith/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RubyOnWorld","download_url":"https://codeload.github.com/RubyOnWorld/csmith/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239599040,"owners_count":19665911,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["csmith","generator","primary"],"created_at":"2024-11-07T14:24:35.546Z","updated_at":"2025-11-12T05:30:21.788Z","avatar_url":"https://github.com/RubyOnWorld.png","language":"C++","readme":"# ![](./csmith.png)\n\n## About\n\nCsmith is a random generator of C programs. It's primary purpose is to find\ncompiler bugs with random programs, using differential testing as the\ntest oracle.\n\nCsmith can be used outside of the field of compiler testing.\nIf your application needs a test suite of C programs and you don't bother to\nwrite them, feel free to give Csmith a try.\n\nCsmith outputs C programs free of undefined behaviors (believe us, that's\nnot trivial), and the statistics of each generated program.\n\n## Install Csmith\n\nYou can install Csmith from tarballs downloaded from [here (coming soon)](doc/releases.md),\nor you can build it from the source. The following commands\napply to Ubuntu.\n\n```\ngit clone https://github.com/csmith-project/csmith.git\ncd csmith\nsudo apt install g++ cmake m4\ncmake -DCMAKE_INSTALL_PREFIX=\u003cINSTALL-PREFIX\u003e .\nmake \u0026\u0026 make install\n```\n\nPlease see specific instructions for [building on\nWindows](doc/build-csmith-on-windows.md).\n\n## Use Csmith\n\nSuppose Csmith is installed to `$HOME/csmith` locally. You can simply\ngenerate, compile, and execute a test case by:\n\n```bash\nexport PATH=$PATH:$HOME/csmith/bin\ncsmith \u003e random1.c\ngcc random1.c -I$HOME/csmith/include -o random1\n./random1\n```\n\nTo add differential testing into the picture, we need to install another\ncompiler, e.g., another version of **gcc** or **clang**. And repeat the process of:\n\n```\ncsmith \u003e random2.c\ngcc random2.c -I$HOME/csmith/include -o random2_gcc\nclang random2.c -I$HOME/csmith/include -o random2_clang\n./random2_gcc \u003e gcc_output.txt\n./random2_clang \u003e clang_output.txt\n```\n\nIf there is any difference in `gcc_output.txt` and `clang_output.txt`,\naha, you have found a bug in either **gcc** or **clang**, or, in the\nunlikely case, a bug in Csmith itself.\n\nYou could write scripts in your favorite language to repeat\nthe above process to amplify the power of random differential testing.\n\nThe generate programs might contain infinite loops. The best practice is\nto apply timeout to their executions.\n\nUse `csmith -h` or `csmith -hh` to see lists of command line options that you\ncan pass to Csmith and customize the random generation.\n\nHere is a slightly outdated but still relevant document about\n[using Csmith for compiler testing](http://embed.cs.utah.edu/csmith/using.html).\n\n## History\n\nCsmith was originally developed at the University of Utah by:\n\n* [Xuejun Yang](https://github.com/jxyang)\n* [Yang Chen](https://github.com/chenyang78)\n* [Eric Eide](https://github.com/eeide)\n* [John Regehr](https://github.com/regehr)\n\nas part of a research project on compiler testing. The research is best\nsummarized by our paper\n[Finding and Understanding Bugs in C Compilers](https://www.cs.utah.edu/~regehr/papers/pldi11-preprint.pdf).\nMore research info can be found\n[here](http://embed.cs.utah.edu/csmith/).\n\nCsmith was open sourced in 2009. We try to keep maintaining it as an open source\nproject using discretionary times. As much, the response to bug reports or\nfeature requests might be delayed.\n\n## Community\n\nPlease use github [issues](https://github.com/csmith-project/csmith/issues/new)\nto report bugs or suggestions.\n\nWe have a mailing list for discussing Csmith.\nPlease visit [here](http://www.flux.utah.edu/mailman/listinfo/csmith-dev) to subscribe.\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubyonworld%2Fcsmith","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frubyonworld%2Fcsmith","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frubyonworld%2Fcsmith/lists"}