David Malcolm

Recent Posts

Static analysis in GCC 10

Static analysis in GCC 10

I work at Red Hat on GCC, the GNU Compiler Collection. For the next major release of GCC, GCC 10, I’ve been implementing a new -fanalyzer option: A static analysis pass to identify various problems at compile-time, rather than at runtime.

My thinking here is that it’s best to catch problems as early as possible as the code is written, using the compiler the code is written in as part of the compile-edit-debug cycle, rather than having static analysis as an extra tool “on the side” (perhaps proprietary). Hence, it seems worthwhile to have a static analyzer built into the compiler that can see exactly the same code as the compiler sees—because it is the compiler.

Continue reading “Static analysis in GCC 10”

Usability improvements in GCC 8

Usability improvements in GCC 8

I work at Red Hat on GCC, the GNU Compiler Collection.

My main focus for the last year has been on making GCC easier to use, so I thought I’d write about some of the C and C++ improvements I’ve made that are in the next major release of GCC, GCC 8. You can easily install GCC 8 on Red Hat Enterprise Linux 6 and 7 using Red Hat Developer Toolset (DTS).  GCC 8 is the default compiler in Red Hat Enterprise Linux 8 Beta. GCC 8 is also available in Fedora 28 and later.

Continue reading “Usability improvements in GCC 8”


GCC 6: -Wmisleading-indentation vs “goto fail;”

I work at Red Hat on GCC, the GNU Compiler Collection. The next major release of GCC, GCC 6, is just around the corner, so I thought I’d post about a new compiler warning I’ve contributed to it:

One of the more common “gotchas” in C and C++ programming relates to missing braces. For example, in the following:

  if (some_condition ())
    do_foo ();
    do_bar ();

Continue reading "GCC 6: -Wmisleading-indentation vs “goto fail;”"


JIT-compilation using GCC 5

In an earlier post, I talked about GCC (the GNU Compiler Collection), and work that I did to make the internals of GCC more robust for GCC 5.

gnu logo

This post is about something more user-visible: as of GCC 5, GCC’s code-generation backend can now be built as a shared library.

When might you want to generate machine code? The primary reason is for speed: anything that parses an input format and repeatedly acts on it, such as language interpreter, or a regular expression engine, might benefit from doing some work up-front to translate the input (or some part of it) directly into machine code.

Continue reading “JIT-compilation using GCC 5”


Improving GCC’s internals

If you’ve done any C or C++ development on Fedora or Red Hat Enterprise Linux (RHEL), you’ll have used GCC, the GNU Compiler Collection.

Red Hat has long been a leading contributor to GCC, and this continues as we work with others in the “upstream” GCC community on the next major release:  GCC 5.

gnu logo

In this post I’ll talk about some of the deep architectural changes I’ve been making to GCC. You won’t directly see these changes unless you look at GCC’s own source code, but they make GCC more robust – you’ll be less likely to see an “Internal Compiler Error”, and they make GCC development easier.

Continue reading “Improving GCC’s internals”