ArticleslgStudy

computer science

GNU Compiler Collection

GNU Compiler Collection is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand GNU Compiler Collection rather than just read about it. In short: The GNU Compiler Collection (GCC; formerly GNU C Compiler) is a collection of compilers from the GNU Project that support various programming languages, hardware architectures, and operating systems. The Free Software Foundation (FSF) distributes GCC as free software under the GNU General Public License (GNU GPL).

GNU Compiler Collection — main illustration
GNU Compiler Collection — illustration

Key takeaways

  • GNU Compiler Collection belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect GNU Compiler Collection to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of GNU Compiler Collection from memory before moving on to harder problems.

Reference excerpt

The GNU Compiler Collection (GCC; formerly GNU C Compiler) is a collection of compilers from the GNU Project that support various programming languages, hardware architectures, and operating systems. The Free Software Foundation (FSF) distributes GCC as free software under the GNU General Public License (GNU GPL). GCC is a key component of the GNU toolchain which is used for most projects related to GNU and the Linux kernel. With roughly 15 million lines of code in 2019, GCC is one of the largest free programs in existence, and holds a significant role in the growth of free software, as both a tool and an example. When it was first released in 1987 by Richard Stallman, GCC 1.0 was named the GNU C Compiler since it only handled the C programming language. It was extended to compile C++ in December of that year. Front ends were later developed for Objective-C, Objective-C++, Fortran, Ada, Go, D, Modula-2, Rust, COBOL, and ALGOL 68 among others. The OpenMP and OpenACC specifications are also supported in the C and C++ compilers. As well as being the official compiler of the GNU operating system, GCC has been adopted as the standard compiler by many other modern Unix-like computer operating systems, including most Linux distributions. Most BSD family operating systems also switched to GCC shortly after its release, although since then, FreeBSD and Apple macOS have moved to the Clang compiler, largely due to licensing reasons. GCC can also compile code for Windows, Android, iOS, Solaris, HP-UX, AIX, and MS-DOS compatible operating systems. GCC has been ported to more platforms and instruction set architectures than any other compiler, and is widely deployed as a tool in the development of both free and proprietary software. GCC is also available for many embedded systems, including ARM-based and Power ISA-based chips.

History In late 1983, in an effort to bootstrap the GNU operating system, Richard Stallman asked Andrew S. Tanenbaum, the author of the Amsterdam Compiler Kit (also known as the Free University Compiler Kit), for permission to use that software for GNU. When Tanenbaum advised him that the compiler itself was not free, but rather only the university, Stallman decided to work on a different compiler. His initial plan was to rewrite an existing compiler from Lawrence Livermore National Laboratory for the Pastel language, written in Pastel, with some help from Len Tower and others. Stallman wrote a new C front end for the Livermore compiler, but then realized that it required megabytes of stack space, an impossibility on a 68000 Unix system that did not allow more than 64 KB of stack space, and concluded he would have to write a new compiler from scratch. None of the Pastel compiler code ended up in GCC, though Stallman did use the C front end he had written in Pastel. GCC was first released March 22, 1987, available by FTP from MIT. Stallman was listed as the author but cited others for their contributions, including Tower for "parts of the parser, RTL generator, RTL definitions, and of the Vax machine description", Jack Davidson and Christopher W. Fraser for the idea of using RTL as an intermediate language, and Paul Rubin for writing most of the preprocessor. Described as the "first free software hit" by Peter H. Salus, the GNU compiler arrived just at the time when Sun Microsystems was unbundling its development tools from its operating system, selling them separately at a higher combined price than the previous bundle, which led many of Sun's users to buy or download GCC instead of the vendor's tools. While Stallman considered GNU Emacs as his main project, by 1990 GCC supported thirteen computer architectures, was outperforming several vendor compilers, and was used commercially by several companies.

EGCS fork As GCC was licensed under the GPL, programmers wanting to work in other directions—particularly those writing interfaces for languages other than C—were free to develop their own fork of the compiler, provided they meet the GPL's terms, including its requirements to distribute source code. Multiple forks proved inefficient and unwieldy, however, and the difficulty in getting work accepted by the official GCC project was greatly frustrating for many, as the project favored stability over new features. The FSF kept such close control on what was added to the official version of GCC 2.x (developed since 1992) that GCC was used as one example of the "cathedral" development model in Eric S. Raymond's 1997 essay The Cathedral and the Bazaar. In 1997, a group of developers formed the Experimental/Enhanced GNU Compiler System (EGCS) to merge several experimental forks into a single project. The basis of the merger was a development snapshot of GCC (taken around the 2.7.2 and later followed up to 2.8.1 release). Mergers included g77 (Fortran), PGCC (P5 Pentium-optimized GCC), many C++ improvements, and many new architectures and operating system variants. While both projects followed each other's changes closely, EGCS development proved considerably more vigorous, so much so that the FSF officially halted development on their GCC 2.x compiler, blessed EGCS as the official version of GCC, and appointed the EGCS project as the GCC maintainers in April 1999. With the release of GCC 2.95 in July 1999 the two projects were once again united. GCC has since been maintained by a varied group of programmers from around the world under the direction of a steering committee. GCC 3 (2002) removed a front-end for CHILL due to a lack of maintenance. Before version 4.0 the Fortran front end was g77, which only supported FORTRAN 77, but later was dropped in favor of the new GNU Fortran front end that supports Fortran 95 and large parts of Fortran 2003 and Fortran 2008 as well. As of version 4.8, GCC is implemented in C++. Support for Cilk Plus existed from GCC 5 to GCC 7. GCC has been ported to a wide variety of instruction set architectures, and is widely deployed as a tool in the development of both free and proprietary software. GCC is also available for many embedded systems, including Symbian (called gcce), ARM-based, and Power ISA-based chips. The compiler can target a wide variety of platforms, including video game consoles such as the PlayStation 2, Cell SPE of PlayStation 3, and Dreamcast. It has been ported to "more than 60 platforms".

… excerpt ends here. Continue reading the full article.

Illustrations

GNU Compiler Collection illustration
GNU Compiler Collection illustration
GNU Compiler Collection: Overview of GCC's extended compilation pipeline, including specialized programs like the preprocessor, assembler and linker.
Overview of GCC's extended compilation pipeline, including specialized programs like the preprocessor, assembler and linker.
GNU Compiler Collection: GCC follows the 3-stage architecture typical of multi-language and multi-CPU compilers. All program trees are converted to a common abstract representation at the "middle end", allowing code optimization and binary code generation facilities to be shared by all languages.
GCC follows the 3-stage architecture typical of multi-language and multi-CPU compilers. All program trees are converted to a common abstract representation at the "middle end", allowing code optimization and binary code generation facilities to be shared by all languages.
GNU Compiler Collection: Front ends consist of preprocessing, lexical analysis, syntactic analysis (parsing) and semantic analysis. The goals of compiler front ends are to either accept or reject candidate programs according to the language grammar and semantics, identify errors and handle valid program representations to later compiler stages. This example shows the lexer and parser steps performed for a simple program written in C.
Front ends consist of preprocessing, lexical analysis, syntactic analysis (parsing) and semantic analysis. The goals of compiler front ends are to either accept or reject candidate programs according to the language grammar and semantics, identify errors and handle valid program representations to later compiler stages. This example shows the lexer and parser steps performed for a simple program written in C.

Worked examples

Example 1 — a first encounter with GNU Compiler Collection

Start with the simplest possible case. Write down what GNU Compiler Collection claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to GNU Compiler Collection before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about GNU Compiler Collection ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of GNU Compiler Collection

In research
GNU Compiler Collection appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses GNU Compiler Collection in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
GNU Compiler Collection is common in secondary-school and first-year university syllabi. It links to neighbouring topics 1987 software, C++ compilers, C (programming language) compilers, so understanding it makes those chapters shorter.
In everyday life
Look for GNU Compiler Collection outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “GNU Compiler Collection” →

How to study GNU Compiler Collection in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what GNU Compiler Collection means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain GNU Compiler Collection out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is GNU Compiler Collection in simple terms?

The GNU Compiler Collection (GCC; formerly GNU C Compiler) is a collection of compilers from the GNU Project that support various programming languages, hardware architectures, and operating systems. The Free Software Foundation (FSF) distributes GCC as free software under the GNU General Public Li…

Why does GNU Compiler Collection matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study GNU Compiler Collection?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on GNU Compiler Collection.

Tags

  • 1987 software
  • C++ compilers
  • C (programming language) compilers
  • Compilers
  • Cross-platform free software
  • Fortran compilers
  • Free and open source compilers
  • Free software programmed in C++
  • GNU Project software
  • Java development tools
  • Pascal (programming language) compilers
  • Software that was rewritten in C++

Keep exploring