GNU Compiler Collection facts for kids
![]() |
|
![]() A screenshot of GCC 10.2 compiling its own computer code.
|
|
Original author(s) | Richard Stallman |
---|---|
Developer(s) | GNU Project |
Initial release | March 22, 1987 |
Stable release | |
Preview release |
Lua error in Module:Wd at line 1575: attempt to index field 'wikibase' (a nil value).
|
Written in | C, C++ |
Operating system | Cross-platform |
Platform | GNU and many others |
Size | ~15 million LOC |
Available in | English |
Type | Compiler |
License | GPLv3+ with GCC Runtime Library Exception |
The GNU Compiler Collection, usually called GCC, is a powerful set of tools created by the GNU Project. Think of it as a master translator for computers. Programmers write instructions in languages like C++ or Rust, but computers only understand a very basic language called machine code. GCC's job is to translate the programmer's code into machine code that a computer's processor can run.
GCC is very important because it is free software. This means anyone can use, study, and share it. It's a key part of the tools used to build the Linux kernel and many other free software projects. With about 15 million lines of code, it's one of the biggest free software programs ever made.
When it first came out in 1987, it was called the GNU C Compiler because it only worked with the C programming language. Over the years, it learned to understand many more languages. Today, GCC can create programs for all sorts of computers and operating systems, from laptops running Linux or Windows to smartphones running Android.
Contents
History of GCC
Why Was GCC Created?
In the early 1980s, a programmer named Richard Stallman had a big idea. He wanted to create a completely free operating system called GNU. An operating system is the main software that runs a computer, like Windows or macOS. To build this new system, he needed tools, and the most important tool was a compiler.
Stallman first tried to get permission to use an existing compiler, but he was told it wasn't free. So, he decided to write a brand-new compiler from scratch. He released the first version of GCC on March 22, 1987. It quickly became popular because it was free and worked very well. At the time, many companies started charging a lot of money for their compilers, so many programmers switched to GCC.
A New Version is Born
By the late 1990s, GCC was very stable, but some developers wanted to add new features more quickly. In 1997, a group of programmers created their own version of GCC called EGCS. This new version combined several experimental features, like better support for the C++ language and the Fortran language for scientific computing.
The EGCS project was so successful and developed so quickly that in 1999, the original creators of GCC decided to make EGCS the official version. The two projects joined back together, and the team of developers who made EGCS became the new leaders of the GCC project.
How GCC Works: A Look Inside
A compiler's job is complex. GCC breaks it down into three main stages, like an assembly line in a factory. This smart design allows it to work with many different programming languages and for many types of computers.
The Front End: Understanding the Language
The first stage is the front end. Each programming language, like C++, Ada, or Go, has its own unique grammar and rules. GCC has a separate front end for each language it supports. The front end reads the programmer's code and checks it for errors. If everything is correct, it turns the code into a special, tree-like structure that the next stage can understand.
The Middle End: Making the Code Better
The second stage is the middle end. This is where the real magic of GCC happens. The middle end takes the tree-like structure from the front end and works to improve it. This is called optimization. It looks for ways to make the final program run faster and use less memory. For example, it might remove unneeded steps or rearrange instructions to be more efficient. This stage is the same for all languages, which is a big reason why GCC is so powerful.
The Back End: Building for a Target
The final stage is the back end. This part takes the optimized code from the middle end and translates it into the final machine code. Different types of computer processors, or architectures, speak different machine languages. The back end knows how to "speak" the language of a specific processor, whether it's an Intel chip in a laptop or an ARM chip in a smartphone.
What Languages Does GCC Support?
GCC is famous for supporting a wide variety of programming languages. As of 2025, the main languages included are:
- C (
gcc
) - C++ (
g++
) - Objective-C and Objective-C++
- Fortran (
gfortran
) - Ada (
GNAT
) - Go (
gccgo
) - D (
gdc
) - Modula-2 (
gm2
) - Rust (
gccrs
) - COBOL (
gcobol
)
It also supports extensions for parallel programming, which helps programs use multiple processor cores at once to run even faster.
What Computers Can GCC Build For?
GCC is known as a cross-platform compiler, which means it can create programs for many different types of computer systems. It has been adapted to work with more processor architectures than any other compiler.
Some of the most common processor families it supports include:
- x86 and x86-64: The processors found in most desktop and laptop computers from Intel and AMD.
- ARM: The processors used in most smartphones, tablets, and many small devices like the Raspberry Pi.
- PowerPC: An architecture that was used in older Apple Mac computers and game consoles like the Nintendo Wii and PlayStation 3.
- RISC-V: A newer, open-source architecture that is becoming more popular.
- SPARC: A processor family originally designed by Sun Microsystems.
GCC can also create software for many different operating systems, including Linux, Windows, macOS, Android, and many others. This flexibility makes it one of the most useful tools for software developers around the world.
Images for kids
See also
In Spanish: GNU Compiler Collection para niños
- List of compilers
- MinGW
- LLVM/Clang