mygcc

the customizable gcc compiler

what's this?

Mygcc is an extensible version of gcc (the GNU C compiler), that can be customized very easily by adding user-defined checks for detecting for example memory leaks, unreleased locks, or null pointer dereferences. User-defined checks are performed in addition to normal compilation, and may result in additional warning messages.

Gcc already includes many built-in checks such as uninitialized variables, undeclared functions, format string inspection, etc. Mygcc allows programmers to add their own checks that take into account syntax, control flow, and data flow information.

The implementation of mygcc as a lightweight patch to gcc is based on the disruptive concept of unparsed pattern matching, which make the patch easily portable to virtually any other compiler for any language X, written in any language Y. Unparsed patterns are now also available as the myPatterns open source library for pattern matching of general data structures in any C program (not just for matching program trees in compilers!).

documentation

Journal paper:

Conference papers:

examples

download

Mygcc's patch to gcc did not currently got the approval to become part of the standard gcc release, because of some technical reason: the implementation is dependent on a possibly evolving part in gcc, namely the pretty-printer. As a consequence, a condition for future inclusion is to switch from the unparsed pattern matching mechanism to a more classical tree pattern matching. This implies a major rewrite of the patch, consisting in a pattern parser. Any volunteer for this task is warmly welcome! Until then, we distribute separate snapshots.

Enjoy using mygcc, and feel free to send us any feedback!

history

Mygcc has been originally developed by Nic Volanschi, starting in 2004.

In 2006, Sebastian Pop joined the team, incorporated and maintained the patch inside the Graphite gcc branch some time, and ensured it got more compatible and coherent with the rest of gcc. Later on, the patch got its own branch called Condate, waiting to get mature enough to be submitted to the main trunk (as explained above).

In 2007, Zhouyi Zhou et.al. extended the mygcc patch to gcc in order to apply it for checking the MAC Framework implementation of the FreeBSD kernel, as part of a Google Summer of Code project. Their extensions are available separately.

Many other people provided very useful feedback.

bugs

Mygcc is still an experimental compiler. If you encounter problems using it, please consider reporting the bugs you found.

future

Mygcc tries to prove that it is possible to perform useful checks within a compiler, without compromising its performance or usability. But this is just a starting point. Many interesting features may be experimented to explore further the promises of the checking compiler concept.

See our plans for future work. You might as well be interested in contributing.

Last update: 7/9/2008. Contact: mygcc@free.fr