the customizable gcc compiler
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!).
Overview of mygcc
An
on-line very brief introduction to the checking compiler concepts.
Journal paper:
N. Volanschi. A portable
compiler-integrated approach to permanent checking.
Journal: Automated Software Engineering. Volume 15, Number 1 / March, 2008.
ISSN: 0928-8910 (print version),
ISSN: 1573-7535 (online version). The original publication is
available at www.springerlink.com
DOI: 10.1007/s10515-007-0022-4.
This journal version unifies
and improves on the two papers below.
Conference papers:
N. Volanschi. A portable
compiler-integrated approach to permanent checking. In the
21st IEEE/ACM International Conference on Automated Software
Engineering (ASE'06). This paper received a "Distinguished
ASE paper" award.
A paper presenting mygcc and
showing how it enables performing user-defined checks throughout the
software development process. Also contains a comparative checking
of Linux kernels 2.4.1 and 2.6.13 demonstrating the usefulness of
permanent checking.
N. Volanschi. Condate: a
proto-language at the confluence between checking and compiling.
In the 8th ACM-SIGPLAN International Symposium on Principles and
Practice of Declarative Programming (PPDP'06).
A companion
paper of the above, formalizing user-defined checks performed by
mygcc in the form of a declarative language. Also
presents in detail the application of mygcc to parts
of the Linux kernel 2.4.1.
Examples using version 1.0.1
mygcc version 0.1.0 has been applied on about 90 source files of the Linux kernel v 2.4.1
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!
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.
Mygcc is still an experimental compiler. If you encounter problems using it, please consider reporting the bugs you found.
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