gcc-python-plugin is a plugin for GCC 4.6 onwards which embeds the CPython interpreter within GCC, allowing you to write new compiler warnings in Python, generate code visualizations, etc.
It ships with "gcc-with-cpychecker", which implements static analysis passes for GCC aimed at finding bugs in CPython extensions. In particular, it can automatically detect reference-counting errors: http://gcc-python-plugin.readthedocs.org/en/latest/cpychecker.html
What's new in 0.11? ===================
The main change in this release is support for compiling the plugin with a C++ compiler. Recent versions of GCC 4.7 are now built with C++ rather than C, meaning that plugins must also be built with C++ (since all of GCC’s internal symbols are name-mangled). This release fixes the plugin’s Makefile so that it autodetects whether the plugin needs to be built with a C or C++ compiler and (I hope) does the right thing automatically. I've also made the necessary changes to the C source code of the plugin so that it is compilable as either language.
This should enable the plugin to now be usable with recent builds of gcc 4.7.* (along with gcc 4.6).
The plugin doesn't yet support gcc 4.8 prereleases (help would be appreciated!)
For a description of the other improvements in 0.11, detailed release notes can be seen at: http://gcc-python-plugin.readthedocs.org/en/latest/0.11.html
Tarball releases are available at: https://fedorahosted.org/releases/g/c/gcc-python-plugin/
Prebuilt-documentation can be seen at: http://gcc-python-plugin.readthedocs.org/en/latest/index.html
The project's homepage is: https://fedorahosted.org/gcc-python-plugin/
The plugin and checker are Free Software, licensed under the GPLv3 or later.
Enjoy! Dave Malcolm