Git Product home page Git Product logo

csmith_code_gen_for_armv8's Introduction

About

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.

Csmith can be used outside of the field of compiler testing. If your application needs a test suite of C programs and you don't bother to write them, feel free to give Csmith a try.

Csmith outputs C programs free of undefined behaviors (believe us, that's not trivial), and the statistics of each generated program.

Install Csmith

You can install Csmith from tarballs downloaded from here (coming soon), or you can build it from the source. The following commands apply to Ubuntu.

git clone https://github.com/csmith-project/csmith.git
cd csmith
sudo apt install g++ cmake m4
cmake -DCMAKE_INSTALL_PREFIX=<INSTALL-PREFIX> .
make && make install

Please see specific instructions for building on Windows.

Use Csmith

Suppose Csmith is installed to $HOME/csmith locally. You can simply generate, compile, and execute a test case by:

export PATH=$PATH:$HOME/csmith/bin
csmith > random1.c
gcc random1.c -I$HOME/csmith/include -o random1
./random1

To add differential testing into the picture, we need to install another compiler, e.g., another version of gcc or clang. And repeat the process of:

csmith > random2.c
gcc random2.c -I$HOME/csmith/include -o random2_gcc
clang random2.c -I$HOME/csmith/include -o random2_clang
./random2_gcc > gcc_output.txt
./random2_clang > clang_output.txt

If there is any difference in gcc_output.txt and clang_output.txt, aha, you have found a bug in either gcc or clang, or, in the unlikely case, a bug in Csmith itself.

You could write scripts in your favorite language to repeat the above process to amplify the power of random differential testing.

The generate programs might contain infinite loops. The best practice is to apply timeout to their executions.

Use csmith -h or csmith -hh to see lists of command line options that you can pass to Csmith and customize the random generation.

Here is a slightly outdated but still relevant document about using Csmith for compiler testing.

History

Csmith was originally developed at the University of Utah by:

as part of a research project on compiler testing. The research is best summarized by our paper Finding and Understanding Bugs in C Compilers. More research info can be found here.

Csmith was open sourced in 2009. We try to keep maintaining it as an open source project using discretionary times. As much, the response to bug reports or feature requests might be delayed.

Community

Please use github issues to report bugs or suggestions.

We have a mailing list for discussing Csmith. Please visit here to subscribe.

csmith_code_gen_for_armv8's People

Contributors

regehr avatar chenyang78 avatar eeide avatar jxyang avatar jensgerlach avatar shubhamnarlawar77 avatar natgla avatar marxin avatar uniqp avatar orestisfl avatar karineek avatar mortior avatar dwightguth avatar antonblanchard avatar mdrafiqulrabin avatar kren1 avatar tahina-pro avatar sebastianboe avatar iwamatsu avatar elfring avatar jibsen avatar jryans avatar gergo- avatar grimreaper avatar bentley avatar alishuja avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.