All Topics  
GNU Compiler Collection

 

   Email Print
   Bookmark   Link






 

GNU Compiler Collection



 
 
The GNU Compiler Collection (usually shortened to GCC) is a compiler
Compiler

A compiler is a computer program that transforms source code written in a programming language into another computer language . The most common reason for wanting to transform source code is to create an executable program....
 system produced by the GNU Project
GNU Project

The GNU Project is a free software, mass collaboration project, announced on September 27 1983 by Richard Stallman. It initiated the GNU operating system, software development for which began in January 1984....
 supporting various programming language
Programming language

A programming language is a machine-readable artificial language designed to express computations that can be performed by a machine, particularly a computer....
s. GCC is a key component of the GNU toolchain
GNU toolchain

The GNU toolchain is a blanket term for a collection of programming tools produced by the GNU Project. These tools form a toolchain used for developing application software and operating systems....
. As well as being the official compiler of the GNU
GNU

GNU is a computer operating system composed entirely of free software. Its name is a recursive acronym for GNU's Not Unix; it was chosen because its design is Unix-like, but differs from Unix by being free software and containing no Unix code....
 system, GCC has been adopted as the standard compiler by most other modern Unix-like
Unix-like

A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....
 computer operating system
Operating system

An operating system is an interface between hardware and applications; it is responsible for the management and coordination of activities and the sharing of the limited resources of the computer....
s, including GNU
GNU

GNU is a computer operating system composed entirely of free software. Its name is a recursive acronym for GNU's Not Unix; it was chosen because its design is Unix-like, but differs from Unix by being free software and containing no Unix code....
/Linux
Linux

Linux is a generic term referring to Unix-like computer operating systems based on the Linux kernel. Their development is one of the most prominent examples of free and open source software collaboration; typically all the underlying source code can be used, freely modified, and redistributed by anyone under the terms of the GNU GPL license...
, the BSD
Berkeley Software Distribution

Berkeley Software Distribution is the Unix operating system derivative developed and distributed by the Computer Systems Research Group of the University of California, Berkeley, from 1977 to 1995....
 family and Mac OS X
Mac OS X

Mac OS X is a line of computer operating systems developed, marketed, and sold by Apple Inc., and since 2002 has been included with all new Macintosh computer systems....
. GCC has been ported
Porting

In computer science, porting is the process of adapting software so that an executable Computer program can be created for a computing environment that is different from the one for which it was originally designed ....
 to a wide variety of processor architectures, and is widely deployed as a tool in commercial, proprietary
Proprietary software

Proprietary software is a term coined by advocates of the free software movement to describe computer software which is the legal property of one party....
 and closed source software development environments.






Discussion
Ask a question about 'GNU Compiler Collection'
Start a new discussion about 'GNU Compiler Collection'
Answer questions from other users
Full Discussion Forum



Encyclopedia


The GNU Compiler Collection (usually shortened to GCC) is a compiler
Compiler

A compiler is a computer program that transforms source code written in a programming language into another computer language . The most common reason for wanting to transform source code is to create an executable program....
 system produced by the GNU Project
GNU Project

The GNU Project is a free software, mass collaboration project, announced on September 27 1983 by Richard Stallman. It initiated the GNU operating system, software development for which began in January 1984....
 supporting various programming language
Programming language

A programming language is a machine-readable artificial language designed to express computations that can be performed by a machine, particularly a computer....
s. GCC is a key component of the GNU toolchain
GNU toolchain

The GNU toolchain is a blanket term for a collection of programming tools produced by the GNU Project. These tools form a toolchain used for developing application software and operating systems....
. As well as being the official compiler of the GNU
GNU

GNU is a computer operating system composed entirely of free software. Its name is a recursive acronym for GNU's Not Unix; it was chosen because its design is Unix-like, but differs from Unix by being free software and containing no Unix code....
 system, GCC has been adopted as the standard compiler by most other modern Unix-like
Unix-like

A Unix-like operating system is one that behaves in a manner similar to a Unix system, while not necessarily conforming to or being certified to any version of the Single UNIX Specification....
 computer operating system
Operating system

An operating system is an interface between hardware and applications; it is responsible for the management and coordination of activities and the sharing of the limited resources of the computer....
s, including GNU
GNU

GNU is a computer operating system composed entirely of free software. Its name is a recursive acronym for GNU's Not Unix; it was chosen because its design is Unix-like, but differs from Unix by being free software and containing no Unix code....
/Linux
Linux

Linux is a generic term referring to Unix-like computer operating systems based on the Linux kernel. Their development is one of the most prominent examples of free and open source software collaboration; typically all the underlying source code can be used, freely modified, and redistributed by anyone under the terms of the GNU GPL license...
, the BSD
Berkeley Software Distribution

Berkeley Software Distribution is the Unix operating system derivative developed and distributed by the Computer Systems Research Group of the University of California, Berkeley, from 1977 to 1995....
 family and Mac OS X
Mac OS X

Mac OS X is a line of computer operating systems developed, marketed, and sold by Apple Inc., and since 2002 has been included with all new Macintosh computer systems....
. GCC has been ported
Porting

In computer science, porting is the process of adapting software so that an executable Computer program can be created for a computing environment that is different from the one for which it was originally designed ....
 to a wide variety of processor architectures, and is widely deployed as a tool in commercial, proprietary
Proprietary software

Proprietary software is a term coined by advocates of the free software movement to describe computer software which is the legal property of one party....
 and closed source software development environments. GCC is also available for most embedded platforms, for example Symbian, AMCC
AMCC

AMCC is a four-letter abbreviation which may refer to:*Applied Micro Circuits Corporation, a semiconductor company.*Allegheny Mountain Collegiate Conference, an intercollegiate athletic conference affiliated with the NCAA?s Division III....
 and Freescale Power Architecture
Power Architecture

Power Architecture is a broad term to describe similar RISC instruction sets for microprocessors developed and manufactured by such companies as IBM, Freescale, Applied Micro Circuits Corporation, Tundra Semiconductor and P.A....
-based chips. The compiler can target a wide variety of platforms, including videogame consoles such as the Playstation 2
PlayStation 2

The PlayStation 2 is a History of video game consoles video game console manufactured by Sony. The successor to the PlayStation, and the predecessor to the PlayStation 3, the PlayStation 2 forms part of the PlayStation of video game consoles....
 and Sega Dreamcast
Sega Dreamcast

The is a video game console made by Sega, and is the successor to the Sega Saturn. An attempt to recapture the console market with a next-generation system, it was designed to supersede the PlayStation and Nintendo 64....
. Several companies make a business out of supplying and supporting gcc ports to various platforms, and chip manufacturers today consider a gcc port almost essential to the success of an architecture.

Originally named the GNU C Compiler, because it only handled the C programming language
C (programming language)

C is a general-purpose computer programming language originally developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories to implement the Unix operating system....
, GCC 1.0 was released in 1987, and the compiler was extended to compile C++
C++

C++ is a general-purpose programming language. It is regarded as a middle-level language, as it comprises a combination of both high-level programming language and low-level programming language language features....
 in December of that year. Front ends were later developed for Fortran
Fortran

Fortran is a general-purpose programming language, procedural programming language, imperative programming language programming language that is especially suited to numerical analysis and scientific computing....
, Pascal
Pascal (programming language)

Pascal is an influential imperative programming and Procedural programming programming language, designed in 1968/9 and published in 1970 by Niklaus Wirth as a small and efficient language intended to encourage good programming practices using structured programming and data structure....
, Objective C, Java
Java (programming language)

Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java ....
, and Ada
Ada (programming language)

Ada is a structured programming, statically typed, Imperative programming, and Object-oriented programming high-level language computer programming programming language, extended from Pascal and other languages....
, among others.

The Free Software Foundation
Free Software Foundation

The Free Software Foundation is a non-profit corporation founded by Richard Stallman on 4 October 1985 to support the free software movement, a copyleft-based movement which aims to promote the universal freedom to distribute and modify computer software without restriction....
 (FSF) distributes GCC under the GNU General Public License
GNU General Public License

The GNU General Public License is a widely used free software license, originally written by Richard Stallman for the GNU project. The GPL is the most popular and well-known example of the type of strong copyleft license that requires derived works to be available under the same copyleft....
 (GNU GPL) and the GNU Lesser General Public License
GNU Lesser General Public License

The GNU Lesser General Public License or LGPL is a free software license published by the Free Software Foundation . It was designed as a compromise between the strong-copyleft GNU General Public License and permissive licenses such as the BSD licenses and the MIT License....
 (GNU LGPL). GCC is free software
Free software

Free Software or software libre is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with minimal restrictions only to ensure that further recipients can also do these things and to prevent consumer-facing hardware...
.

History


Richard Stallman
Richard Stallman

Richard Matthew Stallman , often abbreviated "rms","'Richard Stallman' is just my mundane name; you can call me 'rms'"|last= Stallman...
 started GCC in 1985. He extended an existing compiler to compile C. The compiler originally compiled Pastel, an extended, nonportable dialect of Pascal
Pascal (programming language)

Pascal is an influential imperative programming and Procedural programming programming language, designed in 1968/9 and published in 1970 by Niklaus Wirth as a small and efficient language intended to encourage good programming practices using structured programming and data structure....
, and was written in Pastel. It was rewritten in C by Len Tower
Leonard H. Tower Jr.

Leonard "Len" H. Tower Jr. is a Hacker and activist in the free software movement, environmentalist, artist, poet, and gardener. An Eagle Scout , Tower was also awarded the Honors and awards of the Order of the Arrow#Vigil Honor in the Order of the Arrow....
 and Stallman, and released in 1987 as the compiler for the GNU Project, in order to have a compiler available that was free software
Free software

Free Software or software libre is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with minimal restrictions only to ensure that further recipients can also do these things and to prevent consumer-facing hardware...
. Its development was supervised by the Free Software Foundation
Free Software Foundation

The Free Software Foundation is a non-profit corporation founded by Richard Stallman on 4 October 1985 to support the free software movement, a copyleft-based movement which aims to promote the universal freedom to distribute and modify computer software without restriction....
.

EGCS


By 1991, GCC 1.x had reached a point of stability, but architectural limitations prevented many desired improvements, so the Free Software Foundation
Free Software Foundation

The Free Software Foundation is a non-profit corporation founded by Richard Stallman on 4 October 1985 to support the free software movement, a copyleft-based movement which aims to promote the universal freedom to distribute and modify computer software without restriction....
 (FSF) started work on GCC 2.x. But during the mid-1990s, the FSF kept such close control on what was added to the official version of GCC 2.x that GCC was used as one example of the "cathedral" development model in Eric S. Raymond
Eric S. Raymond

Eric Steven Raymond , often referred to as ESR, is a computer programmer, author and open source software advocate. His name became known within the hacker culture when he became the maintainer of the "Jargon File"....
's essay The Cathedral and the Bazaar
The Cathedral and the Bazaar

The Cathedral and the Bazaar is an essay by Eric S. Raymond on software engineering methods, based on his observations of the Linux kernel development process and his experiences managing an open source project, fetchmail....
.

As GCC was free software
Free software

Free Software or software libre is software that can be used, studied, and modified without restriction, and which can be copied and redistributed in modified or unmodified form either without restriction, or with minimal restrictions only to ensure that further recipients can also do these things and to prevent consumer-facing hardware...
, programmers wanting to work in other directions—particularly those writing interfaces for languages other than C
C (programming language)

C is a general-purpose computer programming language originally developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories to implement the Unix operating system....
—were free to develop their own fork of the compiler. Multiple forks proved inefficient and unwieldy, however, and the difficulty in getting work accepted by the official GCC project was greatly frustrating for many.

In 1997, a group of developers formed EGCS (Experimental/Enhanced GNU Compiler System), to merge several experimental forks into a single project. The basis of the merger was a gcc development snapshot taken between the 2.7 and 2.81 releases. Projects merged included g77 (Fortran
Fortran

Fortran is a general-purpose programming language, procedural programming language, imperative programming language programming language that is especially suited to numerical analysis and scientific computing....
), PGCC (Pentium
Pentium

Introduced on March 22, 1993, the original Pentium was the first superscalar x86 architecture microprocessor. Its fifth-generation x86 microarchitecture was a direct extension of the 80486 architecture with dual integer pipeline s, a faster FPU unit, wider data bus, and features for further reduced address calculation latency....
-optimized GCC), many C++
C++

C++ is a general-purpose programming language. It is regarded as a middle-level language, as it comprises a combination of both high-level programming language and low-level programming language language features....
 improvements, and many new architectures and operating system
Operating system

An operating system is an interface between hardware and applications; it is responsible for the management and coordination of activities and the sharing of the limited resources of the computer....
 variants.

EGCS development proved considerably more vigorous than GCC development, 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. Furthermore, the project explicitly adopted the "bazaar" model over the "cathedral" model. With the release of GCC 2.95 in July 1999, the two projects were once again united.

Uses


GCC is often the compiler of choice for developing software that is required to execute on a wide variety of hardware. Differences in native compilers lead to difficulties in developing code that will compile correctly on all the compilers and build scripts that will run for all the platforms. By using GCC, the same parser
Parsing

In computer science and linguistics, parsing, or, more formally, syntactic analysis, is the process of analyzing a sequence of lexical analysis#Token to determine their grammatical structure with respect to a given formal grammar....
 is used for all platforms, so if the code compiles on one, chances are high that it compiles on all.

GCC is now maintained by a varied group of programmers from around the world. It has been ported to more kinds of processor
Central processing unit

A central processing unit is an electronic circuit that can execute computer programs. This broad definition can easily be applied to many early computers that existed long before the term "CPU" ever came into widespread usage....
s and operating system
Operating system

An operating system is an interface between hardware and applications; it is responsible for the management and coordination of activities and the sharing of the limited resources of the computer....
s than any other compiler.

Languages


The standard compiler release 4.3 includes front ends for C
C (programming language)

C is a general-purpose computer programming language originally developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories to implement the Unix operating system....
, C++
C++

C++ is a general-purpose programming language. It is regarded as a middle-level language, as it comprises a combination of both high-level programming language and low-level programming language language features....
 (G++), Java
Java (programming language)

Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java ....
 (GCJ), Ada
Ada (programming language)

Ada is a structured programming, statically typed, Imperative programming, and Object-oriented programming high-level language computer programming programming language, extended from Pascal and other languages....
 (GNAT
Gnat

Gnat is a colloquial name for many small insects in the order Diptera and specifically within the suborder Nematocera.The males often assemble together in large mating swarms, particularly at dusk, called a "ghost"....
), Objective-C
Objective-C

Objective-C is a Reflection , Object-oriented programming programming language which adds Smalltalk-style message passing to C .Today it is used primarily on Mac OS X, iPhone OS, and GNUstep, three environments based on the OpenStep standard, and is the primary language used for the NEXTSTEP, OpenStep#OPENSTEP, and Cocoa application framew...
, Objective-C++
Objective-C

Objective-C is a Reflection , Object-oriented programming programming language which adds Smalltalk-style message passing to C .Today it is used primarily on Mac OS X, iPhone OS, and GNUstep, three environments based on the OpenStep standard, and is the primary language used for the NEXTSTEP, OpenStep#OPENSTEP, and Cocoa application framew...
, and Fortran
Fortran

Fortran is a general-purpose programming language, procedural programming language, imperative programming language programming language that is especially suited to numerical analysis and scientific computing....
 (GFortran
GFortran

gfortran is the name of the GNU Fortran compiler, which is part of the GNU Compiler Collection . gfortran has replaced the g77 compiler, which stopped development before GCC version 4.0....
). Also available, but not in standard are Modula-2
Modula-2

Modula-2 is a computer programming language invented by Niklaus Wirth at ETH, around 1978, as a successor to his intermediate language Modula. Modula-2 was implemented in 1980 for the Lilith computer, which was commercialized in 1982 by startup company DISER as MC1 and MC2....
, Modula-3
Modula-3

In Computer science, Modula-3 is a programming language conceived as a successor to an upgraded version of Modula-2. While it has been influential in research circles it has not been adopted widely in industry....
, Pascal
Pascal (programming language)

Pascal is an influential imperative programming and Procedural programming programming language, designed in 1968/9 and published in 1970 by Niklaus Wirth as a small and efficient language intended to encourage good programming practices using structured programming and data structure....
, PL/I
PL/I

PL/I is an imperative programming computer programming programming language designed for scientific, engineering, and business applications. It is one of the most feature-rich programming languages and one of the very first in the highly-feature-rich category....
, D
D (programming language)

The D programming language, also known simply as D, is an Object-oriented programming, Imperative programming, Multi-paradigm programming language system programming language by Walter Bright of Digital Mars....
 (gdc), Mercury, VHDL (GHDL). A popular parallel language extension, OpenMP
OpenMP

The OpenMP is an application programming interface that supports multi-platform shared memory multiprocessing programming in C , C++ and Fortran on many architectures, including Unix and Microsoft Windows platforms....
, is also supported.

The Fortran front end was g77 before version 4.0, which only supports Fortran 77. In newer versions, g77 is dropped in favor of the new GFortran
GFortran

gfortran is the name of the GNU Fortran compiler, which is part of the GNU Compiler Collection . gfortran has replaced the g77 compiler, which stopped development before GCC version 4.0....
 front end that supports Fortran 95. A front end for CHILL
Chill

Chill may refer to:* Chill * CHILL programming language* Chill , a British digital radio station* Chill , a song by the Finnish rock band The Rasmus...
 was previously included, but has been dropped owing to a lack of maintenance.

A few experimental branches exist to support additional languages, such as the GCC UPC compiler for Unified Parallel C
Unified Parallel C

Unified Parallel C is an extension of the C designed for high-performance computing on large-scale parallel machines, including those with a common global address space and those with distributed memory ....
.

Architectures

GCC target processor families as of version 4.3 include:

  • Alpha
    DEC Alpha

    Alpha, originally known as Alpha AXP, was a 64-bit reduced instruction set computer instruction set architecture developed by Digital Equipment Corporation , designed to replace the 32-bit VAX complex instruction set computer ISA and its implementations....
  • ARM
    ARM architecture

    The ARM architecture is a 32-bit RISC central processing unit architecture developed by ARM Limited that is widely used in embedded system designs....
  • Atmel AVR
    Atmel AVR

    The AVR is a Modified Harvard architecture 8-bit Reduced instruction set computer single chip microcontroller which was developed by Atmel in 1996....
  • Blackfin
    Blackfin

    Blackfin refers to a family of 16/32-bit microprocessors with built-in Digital Signal Processor functionality, which is traditionally only accompanied by a small and power-efficient microcontroller....
  • HC12
  • H8/300
  • IA-32
    IA-32

    IA-32 , often generically called x86 or x86-32, is the instruction set architecture of Intel's most commercially successful microprocessors....
     (x86
    X86 architecture

    The generic term x86 refers to the most commercially successful instruction set architecture in the history of personal computing. It derived from the model numbers, ending in "86", of the first few processor generations Backward compatibility with the original Intel 8086....
    )
  • x86-64
    X86-64

    x86-64 is a superset of the x86. x86-64 Central processing units can run existing 32-bit or 16-bit x86 programs at full speed, but also support new programs written with a 64-bit address space and other additional capabilities....
  • IA-64
  • Motorola 68000
    Motorola 68000

    The Motorola 68000 is a 16/32-bit Complex instruction set computer microprocessor core designed and marketed by Freescale Semiconductor ....
  • MIPS
    MIPS architecture

    MIPS is a RISC instruction set architecture developed by MIPS Technologies . In the mid to late 1990s, it was estimated that one in three RISC microprocessors produced were MIPS implementations....
  • PA-RISC
  • PDP-11
    PDP-11

    The PDP-11 was a series of 16-bit minicomputers sold by Digital Equipment Corporation from 1970 into the 1990s. Though not explicitly conceived as successor to DEC's PDP-8 computer in the Programmed Data Processor series of computers , the PDP-11 replaced the PDP-8 in many Real-time computing....
  • PowerPC
    PowerPC

    PowerPC is a RISC instruction set architecture created by the 1991 Apple Inc.?IBM?Motorola alliance, known as AIM alliance. Originally intended for personal computers, PowerPC CPUs have since become popular embedded system and high-performance processors....
  • R8C/M16C/M32C
  • SPU
  • System/390/zSeries
    ZSeries

    IBM System z, or earlier IBM eServer zSeries, is a brand name designated by IBM to all its mainframe computers.In 2000, IBM rebranded the existing System/390 to IBM eServer zSeries with the e depicted in IBM's red trademarked symbol....
  • SuperH
    SuperH

    The SuperH is brandname of a certain microcontroller and microprocessor architecture. The SuperH is fundamentally a 32-bit load/store reduced instruction set computer architecture found in a large number of embedded systems....
  • SPARC
    SPARC

    SPARC is a Reduced Instruction Set Computer microprocessor instruction set Computer architecture originally designed in 1985 by Sun Microsystems....
  • VAX
    VAX

    VAX was an instruction set architecture developed by Digital Equipment Corporation in the mid-1970s. A 32-bit complex instruction set computer ISA, it was designed to extend or replace DEC's various Programmed Data Processor ISAs....


Lesser-known target processors supported in the standard release have included:

  • A29K
    AMD Am29000

    The AMD 29000, often simply 29k, was a popular family of RISC-based 32-bit microprocessors and microcontrollers from Advanced Micro Devices....
  • ARC
    ARC International

    ARC International plc is a developer of configurable microprocessor technology. ARC develops synthesisable IP and licenses it to semiconductor companies....
  • ETRAX CRIS
    ETRAX CRIS

    The ETRAX CRIS is a series of CPUs designed and manufactured by Axis Communications for use in embedded systems since 1993. The name is an acronym of the chip's features: Ethernet, Token ring, AXis - Code Reduced instruction set computer....
  • D30V
  • DSP16xx
  • FR-30
  • FR-V
    FR-V

    The Fujitsu FR-V is a VLIW-based RISC microprocessor, including FR-400 and FR-450 which runs Linux, and are also supported by the GNU Compiler Collection....
  • Intel i960
    Intel i960

    Intel's i960 was a RISC-based microprocessor design that became popular during the early 1990s as an embedded system microcontroller, becoming a best-selling CPU in that field, along with the competing AMD 29000....
  • IP2000
  • M32R
    M32R

    The M32R is a 32-bit embedded Reduced instruction set computer microcontroller originally developed and manufactured by Renesas Technology succeeded by a FPGA-implemented Memory management unit'ed M32R which runs Linux, and is supported by the GNU Compiler Collection....
  • 68HC11
    Freescale 68HC11

    The 68HC11 is a 8-bit microcontroller family originally from Motorola, now produced by Freescale Semiconductor, descended from the Motorola 6800 microprocessor....
  • MCORE
  • MMIX
    MMIX

    MMIX is a 64-bit Reduced instruction set computer instruction set Computer architecture designed by Donald Knuth, with significant contributions by John L....
  • MN10200
  • MN10300
  • Motorola 88000
    Motorola 88000

    The 88000 is a microprocessor design produced by Motorola. The 88000 was Motorola's attempt at a home-grown RISC architecture, started in the 1980s....
  • NS32K
    NS320xx

    The 320xx or NS32000 is a series of microprocessors from National Semiconductor . They were likely the first 32-bit general-purpose microprocessors on the market, but due to a number of factors never managed to become a major player....
  • ROMP
    ROMP

    The ROMP or Research Micro Processor was a 10 MHz RISC processor designed by IBM in the early 1980s manufactured on a 2 ?m process with 45,000 transistors....
  • Stormy16
  • V850
    V850

    The NEC Electronics Corporation V850 is a 32-bit embedded RISC microcontroller originally developed and manufactured by NEC Corporation, succeeded by V850 variants named V850ES, V850E, and V850E2 which run uClinux....
  • Xtensa
    Xtensa

    Xtensa is a 32-bit microprocessor core designed by Tensilica.Tensilica describes it as "a configurable, extensible and synthesizable processor core" ......
  • AVR32
    AVR32

    The AVR32 is a 32-bit RISC microprocessor architecture designed by Atmel. The microprocessor architecture was designed by a handful of people educated at the Norwegian University of Science and Technology, including lead designer ?yvind Str?m, PhD and CPU architect Erik Renno, M.Sc in Atmel's Norwegian design center....


Additional processors have been supported by GCC versions maintained separately from the FSF version:

  • D10V
  • LatticeMico32
    LatticeMico32

    LatticeMico32 is a 32-bit microprocessor soft core from Lattice Semiconductor optimized for Field Programmable Gate Arrays .LatticeMico32 is licensed under an open intellectual property core license....
  • MeP
    MEP

    MEP may refer to:* Member of the European Parliament, an elected politician in the European Union* Architectural_engineering#Mechanical.2C_Electrical_and_Plumbing_.28MEP.29, a part of the building design industry...
  • Motorola 6809
  • MicroBlaze
    MicroBlaze

    The MicroBlaze is a Soft microprocessor core designed for Xilinx FPGAs from Xilinx. As a soft-core processor, Microblaze is implemented entirely in the general-purpose memory and logic fabric of Xilinx FPGAs....
  • MSP430
    TI MSP430

    The MSP430 is a microcontroller family from Texas Instruments. Built around a 16-bit CPU, the MSP430 is designed for low cost, low power consumption embedded applications....
  • Nios II
    Nios II

    Nios II is a 32-bit embedded-processor architecture designed specifically for the Altera family of FPGAs. Nios II incorporates many enhancements over the original Nios architecture, making it more suitable for a wider range of embedded computing applications, from DSP to system-control....
     and Nios
    Nios embedded processor

    Now considered obsolete, Nios was Altera's first configurable 16-bit embedded processor for its FPGA product-line. For new designs, Altera recommends the 32-bit Nios II....
  • PDP-10
    PDP-10

    The PDP-10 was a mainframe computer manufactured by Digital Equipment Corporation from the late 1960s on; the name stands for "Programmed Data Processor model 10"....
  • TIGCC
    TIGCC

    TIGCC is a software development environment which allows developers to program and compile A68K Assembly language, GNU assembly, and C programming language code for the Motorola 68000 series Texas Instruments graphing calculators ....
     (m68k
    Motorola 68000

    The Motorola 68000 is a 16/32-bit Complex instruction set computer microprocessor core designed and marketed by Freescale Semiconductor ....
     variant)
  • Z8000
    Zilog Z8000

    The Z8000 was a 16-bit microprocessor introduced by ZiLOG in 1979. The architecture was designed by Bernard Peuto while the logic and physical implementation was done by Masatoshi Shima, assisted by a small group of people....
  • PIC24/dsPIC


When retargeting
Retargetable compiler

In software engineering, retargeting is an attribute of software development tools that have been specifically designed to generate code for more than one computing platform....
 GCC to a new platform, bootstrapping
Bootstrapping (compilers)

Bootstrapping is a term used in computer science to describe the techniques involved in writing a compiler in the target programming language which it is intended to compile....
 is often used.

Structure

GCC's external interface is generally standard for a UNIX
Unix

Unix is a computer operating system originally developed in 1969 by a group of American Telephone & Telegraph employees at Bell Labs, including Ken Thompson , Dennis Ritchie, Douglas McIlroy, and Joe Ossanna....
 compiler. Users invoke a driver program named gcc, which interprets command arguments, decides which language compilers to use for each input file, runs the assembler
Assembly language

An assembly language is a low-level language for programming computers. It implements a symbolic representation of the numeric machine codes and other constants needed to program a particular CPU architecture....
 on their output, and then possibly runs the linker
Linker

In computer science, a linker or link editor is a computer program that takes one ormore object file generated by a compiler and combines them into a single executable program....
 to produce a complete executable binary.

Each of the language compilers is a separate program that inputs source code and outputs assembly code. All have a common internal structure. A per-language front end parses
Parsing

In computer science and linguistics, parsing, or, more formally, syntactic analysis, is the process of analyzing a sequence of lexical analysis#Token to determine their grammatical structure with respect to a given formal grammar....
 the source code in that language and produces an abstract syntax tree
Abstract syntax tree

In computer science, an abstract syntax tree , or just syntax tree, is a directed tree representation of the abstract syntactic structure of source code written in a certain programming language....
 ("tree" for short), and a back end
Front-end and back-end

Front-end and back-end are generalized terms that refer to the initial and the end stages of a process. The front-end is responsible for collecting input in various forms from the user and processing it to conform to a specification the back-end can use....
 converts the trees to GCC's Register Transfer Language
Register Transfer Language

In computer science, register transfer language is a term used to describe a kind of intermediate representation that is very close to assembly language, such as that which is used in a compiler....
 (RTL). Compiler optimization
Compiler optimization

Compiler optimization is the process of tuning the output of a compiler to minimize or maximize some attribute of an executable computer program....
s and static code analysis
Static code analysis

Static code analysis is the Program analysis that is performed without actually executing programs built from that software . In most cases the analysis is performed on some version of the source code and in the other cases some form of the object code....
 techniques (such as FORTIFY_SOURCE, a compiler directive which attempts to discover some buffer overflow
Buffer overflow

In computer security and computer programming, a buffer overflow, or buffer overrun, is an Anomaly in software condition where a process attempts to store data beyond the boundaries of a fixed-length buffer ....
s) are applied to the code. Finally, assembly language is produced using architecture-specific pattern matching
Pattern matching

In computer science, pattern matching is the act of checking for the presence of the constituents of a given pattern. In contrast to pattern recognition, the pattern is rigidly specified....
 originally based on an algorithm of Jack Davidson and Chris Fraser.

GCC is written primarily in C
C (programming language)

C is a general-purpose computer programming language originally developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories to implement the Unix operating system....
, although the C++
C++

C++ is a general-purpose programming language. It is regarded as a middle-level language, as it comprises a combination of both high-level programming language and low-level programming language language features....
, Ada
Ada (programming language)

Ada is a structured programming, statically typed, Imperative programming, and Object-oriented programming high-level language computer programming programming language, extended from Pascal and other languages....
 and Java
Java (programming language)

Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java ....
 frontends contain much code written in those languages.

Front-ends

Frontends vary internally, having to produce trees that can be handled by the backend. The parsers are hand-coded recursive descent parser
Recursive descent parser

A recursive descent parser is a top-down parsing built from a set of Mutual recursion procedures where each such procedure usually implements one of the production rules of the formal grammar....
s.

Until recently, the tree representation of the program was not fully independent of the processor being targeted. Confusingly, the meaning of a tree was somewhat different for different language front-ends, and front-ends could provide their own tree codes.

In 2005, two new forms of language-independent trees were introduced. These new tree formats are called GENERIC
Generic

Generic is something that is general, comon, or inclusive rather than specific, unique, or selective.* Generic mood, a grammatical mood used to make generalized statements like Snow is white...
 and GIMPLE
GIMPLE

In the GNU Compiler Collection, GIMPLE is an intermediate representation of the Computer program in which complex Expression s are split into a three address code using temporary variables....
. Parsing now creates temporary language-dependent trees, which are converting to GENERIC. The so-called "gimplifier" then lowers this more complex form into the simpler SSA
Static single assignment form

In compiler design, static single assignment form is an intermediate representation in which every variable is assigned exactly once. Existing variables in the original IR are split into versions, new variables typically indicated by the original name with a subscript, so that every definition gets its own version....
-based GIMPLE form which is the common language for a large number of new powerful language- and architecture-independent global (function scope) optimizations.

The C
C (programming language)

C is a general-purpose computer programming language originally developed in 1972 by Dennis Ritchie at the Bell Telephone Laboratories to implement the Unix operating system....
 and C++
C++

C++ is a general-purpose programming language. It is regarded as a middle-level language, as it comprises a combination of both high-level programming language and low-level programming language language features....
 front ends currently (ver. 4.3.3) convert directly from front end trees to GIMPLE, and hand that off to the back end rather than first converting to GENERIC.

Optimization

Optimization on trees does not generally fit into what most compiler developers would consider a front end task, as it is not language dependent and does not involve parsing. GCC developers have given this part of the compiler the somewhat contradictory name the "middle end." Some of these optimizations performed at this level include dead code elimination
Dead code elimination

In compiler theory, dead code elimination is a compiler optimization that removes code that does not affect the program. Removing such code has two benefits....
, partial redundancy elimination
Partial redundancy elimination

In compiler theory, Partial redundancy elimination is a compiler optimization that eliminates expressions that are redundant on some but not necessarily all paths through a program....
, global value numbering
Global value numbering

Global value numbering is a compiler optimization based on the SSA intermediate representation. It sometimes helps eliminate redundant code that common subexpression elimination does not....
, sparse conditional constant propagation
Sparse conditional constant propagation

In computer science, sparse conditional constant propagation is an optimization frequently applied in compilers after conversion to static single assignment form ....
, and scalar replacement of aggregates. Array dependence based optimizations such as automatic vectorization and automatic parallelization
Automatic parallelization

Automatic parallelization, also auto parallelization, autoparallelization, parallelization, or //ization , the last two of which imply automation when used in context, refers to converting sequential source code into multi-threaded or vectorized code in order to utilize multiple processors simultaneously in a shared-m...
 are also performed. Profile-guided optimization
Profile-guided optimization

Profile-guided optimization is a compiler optimization technique in computer programming to improve program runtime performance. In contrast to traditional optimization techniques that solely use the source code, PGO uses the results of test runs of the instrumented program to optimize the final generated code....
 is also possible as demonstrated here: http://gcc.gnu.org/install/build.html#TOC4

Back-end

The behavior of GCC's back end is partly specified by preprocessor macros
C preprocessor

The C preprocessor is the preprocessor for the C . In many C implementations, it is a separate computer program invoked by the compiler as the first part of translation....
 and functions specific to a target architecture, for instance to define the endianness
Endianness

In computing, endianness is the byte ordering used to represent some kind of data. Typical cases are the order in which integer values are stored as bytes in computer memory and the transmission order over a network or other medium....
, word size, and calling convention
Calling convention

In computer science, a calling convention is a scheme for how function s receive parameters from their caller and how they return a result; calling conventions can differ in:...
s. The front part of the back end uses these to help decide RTL generation, so although GCC's RTL is nominally processor-independent, the initial sequence of abstract instructions is already adapted to the target.

The exact set of GCC optimizations varies from release to release as it develops, but includes the standard algorithms, such as loop optimization
Loop optimization

In compiler theory, loop optimization plays an important role in improving cache performance, making effective use of parallel processing capabilities, and reducing overheads associated with executing Control flow#Loops....
, jump threading
Jump threading

In computing, jump threading is a compiler optimization. In this pass, conditional jumps in the code that branch to identical or inverse tests are detected, and can be "threaded" through a second conditional test....
, common subexpression elimination
Common subexpression elimination

In computer science, common subexpression elimination is a compiler optimization that searches for instances of identical Expression , and analyses whether it is worthwhile replacing them with a single variable holding the computed value....
, instruction scheduling
Instruction scheduling

In computer science, instruction scheduling is a compiler optimization used to improve instruction-level parallelism, which improves performance on machines with instruction pipelines....
, and so forth. The RTL optimizations are of less importance with the addition of global SSA-based optimizations on GIMPLE
GIMPLE

In the GNU Compiler Collection, GIMPLE is an intermediate representation of the Computer program in which complex Expression s are split into a three address code using temporary variables....
 trees, as RTL optimizations have a much more limited scope, and have less high-level information.

A "reloading" phase changes abstract (pseudo-) registers
Processor register

In computer architecture, a processor register is a small amount of Computer storage available on the CPU whose contents can be accessed more quickly than storage available elsewhere....
 into real machine registers, using data collected from the patterns describing the target's instruction set
Instruction set

An instruction set is a list of all the instruction , and all their variations, that a processor can execute.Instructions include:* Arithmetic such as add and subtract...
. This is a somewhat complicated phase, because it must account for the vagaries of all of GCC's targets.

The final phase is somewhat anticlimactic, because the patterns to match were generally chosen during reloading, and so the assembly code is simply built by running substitutions of registers and addresses into the strings specifying the instructions.

Debugging GCC programs

The primary tool used to debug GCC code is the GNU Debugger
GNU Debugger

The GNU Debugger, usually called just GDB, is the standard debugger for the GNU software system. It is a portable debugger that runs on many Unix-like systems and works for many programming languages, including Ada programming language, C , C++, FreeBASIC, and Fortran programming language....
 (gdb). Among more specialized tools are Valgrind
Valgrind

Valgrind is a programming tool for memory debugger, memory leak detection, and performance analysis. The name Valgrind comes from the name of the main entrance to Valhalla in Norse mythology....
 for finding memory errors and leaks. The GNU Profiler (gprof) can determine how much time is spent in which routines, and how often they are called; this requires programs to be compiled with profiling options.

License

"GCC 4.2.1 was the last release of GCC covered by version 2 of the GNU General Public License
GNU General Public License

The GNU General Public License is a widely used free software license, originally written by Richard Stallman for the GNU project. The GPL is the most popular and well-known example of the type of strong copyleft license that requires derived works to be available under the same copyleft....
. All subsequent releases are released under GPL version 3
GNU General Public License

The GNU General Public License is a widely used free software license, originally written by Richard Stallman for the GNU project. The GPL is the most popular and well-known example of the type of strong copyleft license that requires derived works to be available under the same copyleft....
."

Criticism

GCC has received criticism from OpenBSD
OpenBSD

OpenBSD is a Unix-like computer operating system descended from Berkeley Software Distribution , a Unix derivative developed at the University of California, Berkeley....
 developers such as Theo de Raadt
Theo de Raadt

Theo de Raadt, , born May 19, 1968 in Pretoria, South Africa, is a software engineer who lives in Calgary, Alberta, Canada. He is the founder and leader of the OpenBSD and OpenSSH projects, and was a founding member of the NetBSD project....
 and Otto Moerbeek for being large, buggy, and slow, and for generating poor code. Due to this criticism, and the relatively restrictive GPL that GCC is licensed under (as compared to the BSD license preferred by the various BSD projects), there was an attempt to replace GCC with compilers such as PCC
Portable C Compiler

The Portable C Compiler was an early compiler for the C programming language written by Stephen C. Johnson of Bell Labs in mid-1970s—based in part on ideas from earlier work by Alan Snyder in 1973....
 in NetBSD and OpenBSD or LLVM in FreeBSD.

See also

Open Source compilers:
  • Portable C Compiler
    Portable C Compiler

    The Portable C Compiler was an early compiler for the C programming language written by Stephen C. Johnson of Bell Labs in mid-1970s—based in part on ideas from earlier work by Alan Snyder in 1973....
    , an early alternative to gcc.
  • Amsterdam Compiler Kit
    Amsterdam Compiler Kit

    The Amsterdam Compiler Kit is a fast, lightweight and Retargeting suite and toolchain written by Andrew Tanenbaum and Ceriel Jacobs, and is Minix's native toolchain....
    , a current alternative to gcc, directed towards portability.
  • MinGW
    MinGW

    MinGW , formerly mingw32, is a native porting of the GNU Compiler Collection to Microsoft Windows, along with a set of freely distributable import libraries and header files for the Windows API....
    , a port of gcc to Windows.
  • DJGPP
    DJGPP

    DJGPP is a 32-bit C /C++/Objective C/Objective C/Ada /Fortran development suite for x86+ PC compatibles that runs under DOS or compatibles. It is guided by DJ Delorie, who started the project in 1989....
    , a port of gcc to DOS and Windows.
  • Tiny C Compiler
    Tiny C Compiler

    The Tiny C Compiler is an x86 C compiler created by Fabrice Bellard. It is designed to work for slow computers with little disk space . MS Windows operating system support has been added in version 0.9.23 ....
    , an alternative to gcc, directed towards compiling fast on slow machines.
Formerly proprietary compilers:
  • Watcom C compiler
    Watcom C compiler

    The Watcom C /C++ compiler is esteemed amongst DOS developers by the high execution speed of the compiled code it produces and for having been one of the first compilers to support the Intel 80386 "protected mode"....
    , was OpenSourced in 2000.
Diverse:
  • GCC Summit
    GCC Summit

    The GCC Summit is an annual conference for developers of the GNU Compiler Collection and related free software technologies. The conference is a 3-day event and has been held each year since 2003 in Ottawa, Canada....
    , an annual Summit for gcc developers and free compiler constructors.
  • Boehm garbage collector
    Boehm garbage collector

    In computer science, the Boehm-Demers-Weiser garbage collector, often simply known as Boehm GC, is a conservative Garbage collection for C and C++, which is used by many projects that are implemented in C or C++, as well as by runtime environments for a number of other languages, including the GNU Compiler for Java runtime environment...
    , a garbage collection
    Garbage collection (computer science)

    In computer science, garbage collection is a form of automatic memory management. The garbage collector, or just collector, attempts to reclaim garbage , or memory used by Object that will never be accessed or mutated again by the Application software....
     system that in the form of a library is distributed within gcc.
  • ccache
    Ccache

    In software development, ccache is a tool which caches the output of C /C++ compiler so that the next time, the same compilation can be omitted....
    , a compile time reducer.
  • distcc
    Distcc

    In software development, distcc is a tool for speeding up compiler of source code by using distributed computing over a computer network. With the right configuration, distcc can dramatically reduce a project's compilation time....
    , another compile time reducer.
  • Introspector
    Introspector (program)

    Introspector is a long term and ongoing research project by James Michael DuPont building a software tool to explore the structure of Computer program that can be compiled with the GNU Compiler Collection....
    , a project for documenting the internals of gcc.
  • Low Level Virtual Machine
    Low Level Virtual Machine

    The Low Level Virtual Machine, generally known as LLVM, is a compiler infrastructure, written in C++, which is designed for compile-time, link-time, run-time, and "idle-time" optimization of programs written in arbitrary programming languages....
     (LLVM), is a virtual machine
    Virtual machine

    In computer science, a virtual machine is a software implementation of a machine that executes programs like a real machine.Definitions...
     that uses branched compilers from gcc.
  • OpenMP
    OpenMP

    The OpenMP is an application programming interface that supports multi-platform shared memory multiprocessing programming in C , C++ and Fortran on many architectures, including Unix and Microsoft Windows platforms....
    , a standard for multiple processes programming supported by gcc.


Further reading

  • Richard M. Stallman
    Richard Stallman

    Richard Matthew Stallman , often abbreviated "rms","'Richard Stallman' is just my mundane name; you can call me 'rms'"|last= Stallman...
    : , Free Software Foundation
    Free Software Foundation

    The Free Software Foundation is a non-profit corporation founded by Richard Stallman on 4 October 1985 to support the free software movement, a copyleft-based movement which aims to promote the universal freedom to distribute and modify computer software without restriction....
    , ISBN 0-595-10035-X
  • Richard M. Stallman: , Free Software Foundation, ISBN 1-882114-39-6
  • Brian J. Gough: , Network Theory Ltd., ISBN 0-9541617-9-3
  • Arthur Griffith, GCC: The Complete Reference. McGrawHill/Osborne. ISBN 0-07-222405-3.
  • The Jem Report: More on OpenBSD's New Compiler:


External links

  • , an essay covering GCC development for the 1990s, with 30 monthly reports for in the "Inside Cygnus Engineering" section near the end.
  • , by Brian Gough
  • , by the GCC developers
  • , an essay by Rick Moen recording seven well-known forks, including the GCC/EGCS one
  • [irc://irc.gnu.org/gcc #gcc] IRC channel