Table Of Contents

Previous topic

GCC for New Contributors

Next topic

Debugging GCC

This Page

“Gotchas” and FAQs

What language is GCC implemented in?

As of version 4.8, GCC is (mostly) implemented in C++, C++98 specifically.

The compiler must be buildable with a C++98 compiler. We do allow some support of C++11 features via macros in include/ansidecl.h, which expand as follows where the underlying compiler supports it:

Macro Expansion
OVERRIDE override
FINAL final
CONSTEXPR constexpr

and expand to nothing for C++98 compilers. Doing so allows for catching various problems earlier, and for better documenting the intent of the code.

Why do the source files have a .c extension?

As of version 4.8, GCC is (mostly) implemented in C++, but we haven’t renamed the source files. Hence you will see source files with a .c extension throughout the source tree. These are generally handled by the build system as C++, rather than C.

I tried grepping for struct foo but can’t find it!

It’s often difficult to grep for the declaration of, say, struct foo in the GCC sources due to the presence of “GTY” markers. For example, in the C++ frontend, token are handled using struct cp_token, which is defined as:

/* A C++ token.  */

struct GTY (()) cp_token {
   /* ...fields go here... */
};

These “GTY” markers are annotations to the types, and are used by GCC’s garbage-collector. They’re stripped away by the preprocessor when building GCC itself, but get used by a tool during the build called gengtype.

TODO: how to search for them?

How do I debug GCC?

The gcc binary is actually a relatively small “driver” program, which parses some command-line options, and then invokes one or more other programs to do the real work. See the notes in Debugging GCC for an explanation of how to debug.

What does “PR” mean, e.g. “PR c/71610”?

We use an instance of Bugzilla as our bug tracker. We refer to bugs as “Problem Reports”, or “PR” for short. For example, the bug with ID 71610 affects the “c” component, and might be referred to as “PR c/71610” in discussions on our mailing lists, and in ChangeLog entries.

To see the bug report in Bugzilla, go to https://gcc.gnu.org/PRnnnnn

For example, for PR c/71610, see https://gcc.gnu.org/PR71610

For more information on the bug tracker and filing bugs, see https://gcc.gnu.org/bugs/

Is “ggc” a typo?

“ggc” (as opposed to “gcc”) refers to GCC’s garbage collector.