Jump to content

GNU Compiler Collection: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
Undid revision 1126507314 by 167.102.108.1 (talk)
rm unnecessary comma
 
(36 intermediate revisions by 26 users not shown)
Line 11: Line 11:
| author = [[Richard Stallman]]
| author = [[Richard Stallman]]
| developer = [[GNU Project]]
| developer = [[GNU Project]]
| released = {{Start date and age|1987|03|22}}<ref name="release-history">{{cite web|url=https://gnu.org/software/gcc/releases.html|title=GCC Releases|publisher=GNU Project|access-date=July 24, 2020}}</ref>
| released = {{Start date and age|1987|03|22}}<ref name="release-history">{{cite web|url=https://gnu.org/software/gcc/releases.html|title=GCC Releases|publisher=GNU Project|access-date=July 24, 2020|archive-date=June 4, 2023|archive-url=https://web.archive.org/web/20230604113400/https://www.gnu.org/software/gcc/releases.html|url-status=live}}</ref>
| discontinued =
| discontinued =
| latest release version = {{wikidata|property|preferred|references|edit|Q178940|P348|P548=Q2804309}}
| latest release version = {{wikidata|property|preferred|references|edit|Q178940|P348|P548=Q2804309}}
Line 17: Line 17:
| latest preview version = {{wikidata|property|preferred|references|edit|Q178940|P348|P548=Q51930650}}
| latest preview version = {{wikidata|property|preferred|references|edit|Q178940|P348|P548=Q51930650}}
| latest preview date = {{wikidata|qualifier|preferred|single|Q178940|P348|P548=Q51930650|P577}}
| latest preview date = {{wikidata|qualifier|preferred|single|Q178940|P348|P548=Q51930650|P577}}
| programming language = [[C (programming language)|C]], [[C++]]<ref>{{Cite web|title=GCC Coding Conventions - GNU Project|url=https://gcc.gnu.org/codingconventions.html|access-date=2022-02-07|website=gcc.gnu.org}}</ref>
| programming language = [[C (programming language)|C]], [[C++]]<ref>{{Cite web|title=GCC Coding Conventions - GNU Project|url=https://gcc.gnu.org/codingconventions.html|access-date=2022-02-07|website=gcc.gnu.org|archive-date=May 28, 2023|archive-url=https://web.archive.org/web/20230528012107/https://gcc.gnu.org/codingconventions.html|url-status=live}}</ref>
| operating system = [[Cross-platform]]
| operating system = [[Cross-platform]]
| platform = [[GNU]] and many others
| platform = [[GNU]] and many others
Line 23: Line 23:
| language = English
| language = English
| genre = [[Compiler]]
| genre = [[Compiler]]
| license = [[GNU General Public License|GPLv3+]] with GCC Runtime Library Exception<ref>{{cite web|url=https://gnu.org/licenses/gcc-exception-3.1|title=GCC Runtime Library Exception|access-date=July 24, 2020}}</ref>
| license = [[GNU General Public License|GPLv3+]] with GCC Runtime Library Exception<ref>{{cite web|url=https://gnu.org/licenses/gcc-exception-3.1|title=GCC Runtime Library Exception|access-date=July 24, 2020|archive-date=March 31, 2023|archive-url=https://web.archive.org/web/20230331220440/https://www.gnu.org/licenses/gcc-exception-3.1|url-status=live}}</ref>
| alexa =
| alexa =
| website = {{URL|https://gcc.gnu.org}}
| website = {{URL|https://gcc.gnu.org}}
}}
}}


The '''GNU Compiler Collection''' ('''GCC''') is an [[optimizing compiler]] produced by the [[GNU Project]] supporting various [[programming language]]s, [[Computer architecture|hardware architectures]] and [[operating system]]s. 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]] and the standard compiler for most projects related to [[GNU]] and the [[Linux kernel]]. With roughly 15 million lines of code in 2019, GCC is one of the biggest free programs in existence.<ref name="loc"/> It has played an important role in the growth of [[free software]], as both a tool and an example.
The '''GNU Compiler Collection''' ('''GCC''') is a collection of [[compiler]]s from the [[GNU Project]] that support various [[programming language]]s, [[Computer architecture|hardware architectures]] and [[operating system]]s. 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 biggest free programs in existence.<ref name="loc"/> It has played an important 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)|C programming language]].<ref name="release-history" /> It was extended to compile [[C++]] in December of that year. [[Compiler#Front end|Front ends]] were later developed for [[Objective-C]], [[Objective-C++]], [[Fortran]], [[Ada (programming language)|Ada]], [[D (programming language)|D]] and [[Go (programming language)|Go]], among others.<ref>{{cite web|url=https://gcc.gnu.org/frontends.html|title=Programming Languages Supported by GCC|access-date=2014-06-23|publisher=GNU Project }}</ref> The [[OpenMP]] and [[OpenACC]] specifications are also supported in the C and C++ compilers.<ref name="gcc6">{{Cite web|url=https://gcc.gnu.org/gcc-6/changes.html|title=GCC 6 Release Series — Changes, New Features, and Fixes - GNU Project|website=gcc.gnu.org}}</ref><ref name=":2">{{Cite web|url=https://gcc.gnu.org/wiki/OpenACC|title=OpenACC - GCC Wiki|website=gcc.gnu.org}}</ref>
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)|C programming language]].<ref name="release-history" /> It was extended to compile [[C++]] in December of that year. [[Compiler#Front end|Front ends]] were later developed for [[Objective-C]], [[Objective-C++]], [[Fortran]], [[Ada (programming language)|Ada]], [[D (programming language)|D]], [[Go (programming language)|Go]] and [[Rust (programming language)|Rust]],<ref>{{Citation |title=GCC Rust |date=2023-06-04 |url=https://github.com/Rust-GCC/gccrs |access-date=2023-06-04 |publisher=Rust GCC |archive-date=January 6, 2023 |archive-url=https://web.archive.org/web/20230106134124/https://github.com/Rust-GCC/gccrs |url-status=live }}</ref> among others.<ref>{{cite web|url=https://gcc.gnu.org/frontends.html|title=Programming Languages Supported by GCC|access-date=2014-06-23|publisher=GNU Project|archive-date=January 18, 2023|archive-url=https://web.archive.org/web/20230118185814/https://gcc.gnu.org/frontends.html|url-status=live}}</ref> The [[OpenMP]] and [[OpenACC]] specifications are also supported in the C and C++ compilers.<ref name="gcc6">{{Cite web|url=https://gcc.gnu.org/gcc-6/changes.html|title=GCC 6 Release Series — Changes, New Features, and Fixes - GNU Project|website=gcc.gnu.org|access-date=September 19, 2016|archive-date=September 22, 2016|archive-url=https://web.archive.org/web/20160922161533/http://gcc.gnu.org/gcc-6/changes.html|url-status=live}}</ref><ref name=":2">{{Cite web|url=https://gcc.gnu.org/wiki/OpenACC|title=OpenACC - GCC Wiki|website=gcc.gnu.org|access-date=September 19, 2016|archive-date=April 1, 2015|archive-url=https://web.archive.org/web/20150401174332/https://gcc.gnu.org/wiki/OpenACC|url-status=live}}</ref>


GCC has been [[porting|ported]] to more platforms and [[instruction set architecture]]s 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 system]]s, including [[ARM architecture family|ARM]]-based and [[Power ISA]]-based chips.
GCC has been [[porting|ported]] to more platforms and [[instruction set architecture]]s 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 system]]s, including [[ARM architecture family|ARM]]-based and [[Power ISA]]-based chips.


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 system]]s, including most [[Linux]] distributions. Most [[Berkeley Software Distribution|BSD]] family operating systems also switched to GCC shortly after its release, although since then, [[FreeBSD]], [[OpenBSD]] and [[MacOS|Apple macOS]] have moved to the [[Clang]] compiler,<ref>{{Cite web|url=https://llvm.org/Users.html|title=The LLVM Compiler Infrastructure Project|website=llvm.org}}</ref> largely due to licensing reasons.<ref>{{Cite web|title=Apple's GPLv3 purge|url=http://meta.ath0.com/2012/02/05/apples-great-gpl-purge/|access-date=2021-01-12|website=meta.ath0.com|language=en-us}}</ref><ref>{{Cite web|last=Linnemann|first=Reid|date=June 20, 2012|title=Why Clang|url=https://lists.freebsd.org/pipermail/freebsd-questions/2012-June/242495.html|access-date=2021-01-12}}</ref><ref>{{Cite web|date=2007-10-11|title=August 29, 2007: FreeBSD Foundation Newsletter, August 29, 2007|url=http://www.freebsdfoundation.org/press/2007Aug-newsletter.shtml#Letter|access-date=2021-01-12|archive-url=https://web.archive.org/web/20071011023649/http://www.freebsdfoundation.org/press/2007Aug-newsletter.shtml#Letter|archive-date=October 11, 2007}}</ref> GCC can also compile code for [[Microsoft Windows|Windows]], [[Android (operating system)|Android]], [[iOS]], [[Solaris (operating system)|Solaris]], [[HP-UX]], [[IBM AIX|AIX]] and [[DOS]].<ref>{{Cite web|title=Installing GCC: Binaries - GNU Project - Free Software Foundation (FSF)|url=https://gcc.gnu.org/install/binaries.html|access-date=2021-01-12|website=gcc.gnu.org}}</ref>
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 system]]s, including most [[Linux]] distributions. Most [[Berkeley Software Distribution|BSD]] family operating systems also switched to GCC shortly after its release, although since then, [[FreeBSD]] and [[MacOS|Apple macOS]] have moved to the [[Clang]] compiler,<ref>{{Cite web|url=https://llvm.org/Users.html|title=The LLVM Compiler Infrastructure Project|website=llvm.org|access-date=September 24, 2021|archive-date=January 18, 2023|archive-url=https://web.archive.org/web/20230118185909/https://llvm.org/Users.html|url-status=live}}</ref> largely due to licensing reasons.<ref>{{Cite web|title=Apple's GPLv3 purge|url=http://meta.ath0.com/2012/02/05/apples-great-gpl-purge/|access-date=2021-01-12|website=meta.ath0.com|date=February 5, 2012|language=en-us|archive-date=January 18, 2023|archive-url=https://web.archive.org/web/20230118185910/http://meta.ath0.com/2012/02/05/apples-great-gpl-purge/|url-status=live}}</ref><ref>{{Cite web|last=Linnemann|first=Reid|date=June 20, 2012|title=Why Clang|url=https://lists.freebsd.org/pipermail/freebsd-questions/2012-June/242495.html|access-date=2021-01-12|archive-date=January 18, 2023|archive-url=https://web.archive.org/web/20230118185910/https://lists.freebsd.org/pipermail/freebsd-questions/2012-June/242495.html|url-status=live}}</ref><ref>{{Cite web|date=2007-10-11|title=August 29, 2007: FreeBSD Foundation Newsletter, August 29, 2007|url=http://www.freebsdfoundation.org/press/2007Aug-newsletter.shtml#Letter|access-date=2021-01-12|archive-url=https://web.archive.org/web/20071011023649/http://www.freebsdfoundation.org/press/2007Aug-newsletter.shtml#Letter|archive-date=October 11, 2007}}</ref> GCC can also compile code for [[Microsoft Windows|Windows]], [[Android (operating system)|Android]], [[iOS]], [[Solaris (operating system)|Solaris]], [[HP-UX]], [[IBM AIX|AIX]] and [[DOS]].<ref>{{Cite web|title=Installing GCC: Binaries - GNU Project - Free Software Foundation (FSF)|url=https://gcc.gnu.org/install/binaries.html|access-date=2021-01-12|website=gcc.gnu.org|archive-date=January 5, 2021|archive-url=https://web.archive.org/web/20210105200706/https://gcc.gnu.org/install/binaries.html|url-status=live}}</ref>


== History ==
== History ==
In late 1983, in an effort to [[Bootstrapping (compilers)|bootstrap]] the [[GNU]] operating system, [[Richard Stallman]] asked [[Andrew S. Tanenbaum]], the author of the [[Amsterdam Compiler Kit]] (also known as the ''[[Vrije Universiteit Amsterdam|Free University]]'' ''Compiler Kit'') for permission to use that software for GNU. When Tanenbaum advised him that the compiler was not free, and that only the university was free, Stallman decided to work on a different compiler.<ref>{{cite book |last=von Hagen |first=William |date=2006 |title=The Definitive Guide to GCC |edition=2nd |series=Definitive Guides |publisher=Apress |isbn=978-1-4302-0219-6 |page=XXVII |quote=So he wrote to VUCK's author asking if GNU could use it. Evidently, VUCK's developer was uncooperative, responding that the university was free but that the compiler was not. |url=https://books.google.com/books?id=wQ6r3UTivJgC}}</ref> His initial plan was to rewrite an existing compiler from [[Lawrence Livermore National Laboratory]] from [[Pastel (programming language)|Pastel]] to C with some help from [[Leonard H. Tower Jr.|Len Tower]] and others.<ref name=LLLCompiler>{{cite web | last = Stallman | first = Richard | title = About the GNU Project | publisher = The GNU Project | date = September 20, 2011 | url = https://www.gnu.org/gnu/thegnuproject.html | access-date = October 9, 2011 }}</ref><ref>{{cite journal | editor-last = Puzo | editor-first = Jerome E. | title = Gnu's Zoo | journal = GNU's Bulletin | volume = 1 | issue = 1 | date = February 1986 | publisher = Free Software Foundation | url = https://www.gnu.org/bulletins/bull1.txt | access-date = 2007-08-11 }}</ref> 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 [[Motorola 68000|68000]] Unix system with only 64&nbsp;KB, and concluded he would have to write a new compiler from scratch.<ref name=LLLCompiler /> None of the Pastel compiler code ended up in GCC, though Stallman did use the C front end he had written.<ref name=LLLCompiler /><ref name=":6">{{cite book |last=von Hagen |first=William |date=2006 |title=The Definitive Guide to GCC |edition=2nd |series=Definitive Guides |publisher=Apress |isbn=978-1-4302-0219-6 |page=XXVII |url=https://books.google.com/books?id=wQ6r3UTivJgC}}</ref>
In late 1983, in an effort to [[Bootstrapping (compilers)|bootstrap]] the [[GNU]] operating system, [[Richard Stallman]] asked [[Andrew S. Tanenbaum]], the author of the [[Amsterdam Compiler Kit]] (also known as the ''[[Vrije Universiteit Amsterdam|Free University]]'' ''Compiler Kit'') for permission to use that software for GNU. When Tanenbaum advised him that the compiler was not free, and that only the university was free, Stallman decided to work on a different compiler.<ref>{{cite book |last=von Hagen |first=William |date=2006 |title=The Definitive Guide to GCC |edition=2nd |series=Definitive Guides |publisher=Apress |isbn=978-1-4302-0219-6 |page=XXVII |quote=So he wrote to VUCK's author asking if GNU could use it. Evidently, VUCK's developer was uncooperative, responding that the university was free but that the compiler was not. |url=https://books.google.com/books?id=wQ6r3UTivJgC |access-date=September 25, 2020 |archive-date=April 5, 2024 |archive-url=https://web.archive.org/web/20240405040135/https://books.google.com/books?id=wQ6r3UTivJgC |url-status=live }}</ref> His initial plan was to rewrite an existing compiler from [[Lawrence Livermore National Laboratory]] from [[Pastel (programming language)|Pastel]] to C with some help from [[Leonard H. Tower Jr.|Len Tower]] and others.<ref name=LLLCompiler>{{cite web | last = Stallman | first = Richard | title = About the GNU Project | publisher = The GNU Project | date = September 20, 2011 | url = https://www.gnu.org/gnu/thegnuproject.html | access-date = October 9, 2011 | archive-date = August 9, 2019 | archive-url = https://web.archive.org/web/20190809050636/http://www.gnu.org/gnu/thegnuproject.html | url-status = live }}</ref><ref>{{cite journal | editor-last = Puzo | editor-first = Jerome E. | title = Gnu's Zoo | journal = GNU's Bulletin | volume = 1 | issue = 1 | date = February 1986 | publisher = Free Software Foundation | url = https://www.gnu.org/bulletins/bull1.txt | access-date = 2007-08-11 | archive-date = June 23, 2015 | archive-url = https://web.archive.org/web/20150623180723/http://www.gnu.org/bulletins/bull1.txt | url-status = live }}</ref> 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 [[Motorola 68000|68000]] Unix system with only 64&nbsp;KB, and concluded he would have to write a new compiler from scratch.<ref name=LLLCompiler /> None of the Pastel compiler code ended up in GCC, though Stallman did use the C front end he had written.<ref name=LLLCompiler /><ref name=":6">{{cite book |last=von Hagen |first=William |date=2006 |title=The Definitive Guide to GCC |edition=2nd |series=Definitive Guides |publisher=Apress |isbn=978-1-4302-0219-6 |page=XXVII |url=https://books.google.com/books?id=wQ6r3UTivJgC |access-date=September 25, 2020 |archive-date=April 5, 2024 |archive-url=https://web.archive.org/web/20240405040135/https://books.google.com/books?id=wQ6r3UTivJgC |url-status=live }}</ref>


GCC was first released March 22, 1987, available by [[File Transfer Protocol|FTP]] from [[Massachusetts Institute of Technology|MIT]].<ref>{{cite newsgroup | title = GNU C compiler beta test release | author = Richard M. Stallman (forwarded by Leonard H. Tower Jr.) | date = March 22, 1987 | newsgroup = comp.lang.c | url = https://groups.google.com/group/comp.lang.misc/msg/32eda22392c20f98 | access-date = October 9, 2011 }}</ref> 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 [[Register transfer language|RTL]] as an intermediate language, and Paul Rubin for writing most of the preprocessor.<ref name=GccContributors>{{ citation | last = Stallman | first = Richard M. | title = Using and Porting the GNU Compiler Collection (GCC) | chapter-url = https://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_23.html | publisher = Free Software Foundation, Inc. | date = June 22, 2001 | orig-year = First published 1988 | chapter = Contributors to GNU CC | page = 7 | access-date = June 18, 2015 |postscript=.}}</ref> 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 [[SunOS|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.<ref name="penguin">{{cite book |first=Peter H. |last=Salus |author-link=Peter H. Salus |title=The Daemon, the Gnu and the Penguin |chapter=Chapter 10. SUN and gcc |chapter-url=http://www.groklaw.net/article.php?story=20050525231654621 |publisher=[[Groklaw]] |year=2005}}</ref> 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.<ref>{{cite news|last=Garfinkel|first=Simson L.|author-link=Simson Garfinkel|date=6 August 1990|title=Get ready for GNU software|page=102|newspaper=Computerworld|url=https://books.google.com/books?id=mZ0kj6qvsvYC&pg=PT101|access-date=}}</ref>
GCC was first released March 22, 1987, available by [[File Transfer Protocol|FTP]] from [[Massachusetts Institute of Technology|MIT]].<ref>{{cite newsgroup | title = GNU C compiler beta test release | author = Richard M. Stallman (forwarded by Leonard H. Tower Jr.) | date = March 22, 1987 | newsgroup = comp.lang.c | url = https://groups.google.com/group/comp.lang.misc/msg/32eda22392c20f98 | access-date = October 9, 2011 | archive-date = June 2, 2013 | archive-url = https://web.archive.org/web/20130602041632/http://groups.google.com/group/comp.lang.misc/msg/32eda22392c20f98 | url-status = live }}</ref> 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 [[Register transfer language|RTL]] as an intermediate language, and Paul Rubin for writing most of the preprocessor.<ref name=GccContributors>{{citation | last = Stallman | first = Richard M. | title = Using and Porting the GNU Compiler Collection (GCC) | chapter-url = https://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_23.html | publisher = Free Software Foundation, Inc. | date = June 22, 2001 | orig-year = First published 1988 | chapter = Contributors to GNU CC | page = 7 | access-date = June 18, 2015 | postscript = . | archive-date = January 18, 2023 | archive-url = https://web.archive.org/web/20230118185814/https://gcc.gnu.org/onlinedocs/gcc-2.95.3/gcc_23.html | url-status = live }}</ref> 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 [[SunOS|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.<ref name="penguin">{{cite book |first=Peter H. |last=Salus |author-link=Peter H. Salus |title=The Daemon, the Gnu and the Penguin |chapter=Chapter 10. SUN and gcc |chapter-url=http://www.groklaw.net/article.php?story=20050525231654621 |publisher=[[Groklaw]] |year=2005 |access-date=September 14, 2015 |archive-date=June 20, 2022 |archive-url=https://web.archive.org/web/20220620020435/http://www.groklaw.net/article.php?story=20050525231654621 |url-status=live }}</ref> 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.<ref>{{cite news|last=Garfinkel|first=Simson L.|author-link=Simson Garfinkel|date=6 August 1990|title=Get ready for GNU software|page=102|newspaper=Computerworld|url=https://books.google.com/books?id=mZ0kj6qvsvYC&pg=PT101|access-date=}}</ref>


=== EGCS fork{{Anchor|EGCS Fork}} ===
=== EGCS fork{{Anchor|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 (software development)|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.<ref name="egcs">{{citation | last = Henkel-Wallace | first = David | title = A new compiler project to merge the existing GCC forks | url = https://gcc.gnu.org/news/announcement.html | date = August 15, 1997 | access-date = May 25, 2012 |postscript=.}}</ref> 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 essay ''[[The Cathedral and the Bazaar]]''.
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 (software development)|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.<ref name="egcs">{{citation | last = Henkel-Wallace | first = David | title = A new compiler project to merge the existing GCC forks | url = https://gcc.gnu.org/news/announcement.html | date = August 15, 1997 | access-date = May 25, 2012 | postscript = . | archive-date = January 18, 2023 | archive-url = https://web.archive.org/web/20230118185814/https://gcc.gnu.org/news/announcement.html | url-status = live }}</ref> 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 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.<ref name="egcs" /><ref name=":6" /> 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 (microarchitecture)|P5]] [[Pentium]]-optimized GCC),<ref name=":6" /> many C++ improvements, and many new architectures and [[operating system]] variants.<ref>{{Cite web|title=The Short History of GCC development|url=http://www.softpanorama.org/People/Stallman/history_of_gcc_development.shtml|access-date=2021-01-24|website=www.softpanorama.org}}</ref>
In 1997, a group of developers formed the ''Experimental/Enhanced GNU Compiler System (EGCS)'' to merge several experimental forks into a single project.<ref name="egcs" /><ref name=":6" /> 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 (microarchitecture)|P5]] [[Pentium]]-optimized GCC),<ref name=":6" /> many C++ improvements, and many new architectures and [[operating system]] variants.<ref>{{Cite web|title=The Short History of GCC development|url=http://www.softpanorama.org/People/Stallman/history_of_gcc_development.shtml|access-date=2021-01-24|website=www.softpanorama.org|archive-date=November 9, 2022|archive-url=https://web.archive.org/web/20221109211504/https://softpanorama.org/People/Stallman/history_of_gcc_development.shtml|url-status=live}}</ref>


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.<ref>{{Cite web|title=History - GCC Wiki|url=https://gcc.gnu.org/wiki/History#Reunification|access-date=2020-09-28|website=gcc.gnu.org}}</ref><ref name=":6" /> GCC has since been maintained by a varied group of programmers from around the world under the direction of a steering committee.<ref name=":0">{{Cite web|url=https://gcc.gnu.org/steering.html|title=GCC steering committee - GNU Project|website=gcc.gnu.org}}</ref>
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.<ref>{{Cite web|title=History - GCC Wiki|url=https://gcc.gnu.org/wiki/History#Reunification|access-date=2020-09-28|website=gcc.gnu.org|archive-date=January 18, 2023|archive-url=https://web.archive.org/web/20230118185814/https://gcc.gnu.org/wiki/History#Reunification|url-status=live}}</ref><ref name=":6" /> GCC has since been maintained by a varied group of programmers from around the world under the direction of a steering committee.<ref name=":0">{{Cite web|url=https://gcc.gnu.org/steering.html|title=GCC steering committee - GNU Project|website=gcc.gnu.org|access-date=July 25, 2016|archive-date=January 18, 2023|archive-url=https://web.archive.org/web/20230118185814/https://gcc.gnu.org/steering.html|url-status=live}}</ref>


GCC 3 (2002) removed a front-end for [[CHILL]] due to a lack of maintenance.<ref>{{cite web|title=PATCH&#93; Remove chill|url=https://gcc.gnu.org/ml/gcc-patches/2002-04/msg00887.html|access-date=July 29, 2010|website=gcc.gnu.org}}</ref>
GCC 3 (2002) removed a front-end for [[CHILL]] due to a lack of maintenance.<ref>{{cite web|title=PATCH&#93; Remove chill|url=https://gcc.gnu.org/ml/gcc-patches/2002-04/msg00887.html|access-date=July 29, 2010|website=gcc.gnu.org|archive-date=October 20, 2016|archive-url=https://web.archive.org/web/20161020222510/https://gcc.gnu.org/ml/gcc-patches/2002-04/msg00887.html|url-status=live}}</ref>


Before version 4.0 the Fortran front end was <code>g77</code>, 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.<ref name="gcc_wiki_f2003">{{cite web|title=Chart of Fortran 2003 Features supported by GNU Fortran|url=https://gcc.gnu.org/wiki/Fortran2003Status|access-date=2009-06-25|publisher=[[GNU]]}}</ref><ref name="gcc_wiki_f2008">{{cite web|title=Chart of Fortran 2008 Features supported by GNU Fortran|url=https://gcc.gnu.org/wiki/Fortran2008Status|access-date=2009-06-25|publisher=[[GNU]]}}</ref>
Before version 4.0 the Fortran front end was <code>g77</code>, 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.<ref name="gcc_wiki_f2003">{{cite web|title=Chart of Fortran 2003 Features supported by GNU Fortran|url=https://gcc.gnu.org/wiki/Fortran2003Status|access-date=2009-06-25|publisher=[[GNU]]|archive-date=January 18, 2023|archive-url=https://web.archive.org/web/20230118185814/https://gcc.gnu.org/wiki/Fortran2003Status|url-status=live}}</ref><ref name="gcc_wiki_f2008">{{cite web|title=Chart of Fortran 2008 Features supported by GNU Fortran|url=https://gcc.gnu.org/wiki/Fortran2008Status|access-date=2009-06-25|publisher=[[GNU]]|archive-date=January 18, 2023|archive-url=https://web.archive.org/web/20230118185814/https://gcc.gnu.org/wiki/Fortran2008Status|url-status=live}}</ref>


As of version 4.8, GCC is implemented in C++.<ref>{{Cite web|url=https://gcc.gnu.org/gcc-4.8/changes.html|title=GCC 4.8 Release Series — Changes, New Features, and Fixes - GNU Project|website=gcc.gnu.org}}</ref>
As of version 4.8, GCC is implemented in C++.<ref>{{Cite web|url=https://gcc.gnu.org/gcc-4.8/changes.html|title=GCC 4.8 Release Series — Changes, New Features, and Fixes - GNU Project|website=gcc.gnu.org|access-date=February 17, 2015|archive-date=December 8, 2015|archive-url=https://web.archive.org/web/20151208064435/https://gcc.gnu.org/gcc-4.8/changes.html|url-status=live}}</ref>


Support for [[Cilk Plus]] existed from GCC 5 to GCC 7.<ref>{{Cite web|url=https://gcc.gnu.org/gcc-5/changes.html#c-family|title=GCC 5 Release Series — Changes, New Features, and Fixes|website=gcc.gnu.org}}</ref><ref>{{Cite web|url=https://gcc.gnu.org/gcc-8/changes.html|title=GCC 8 Release Series — Changes, New Features, and Fixes|website=gcc.gnu.org}}</ref>
Support for [[Cilk Plus]] existed from GCC 5 to GCC 7.<ref>{{Cite web|url=https://gcc.gnu.org/gcc-5/changes.html#c-family|title=GCC 5 Release Series — Changes, New Features, and Fixes|website=gcc.gnu.org|access-date=January 13, 2022|archive-date=January 18, 2023|archive-url=https://web.archive.org/web/20230118185814/https://gcc.gnu.org/gcc-5/changes.html#c-family|url-status=live}}</ref><ref>{{Cite web|url=https://gcc.gnu.org/gcc-8/changes.html|title=GCC 8 Release Series — Changes, New Features, and Fixes|website=gcc.gnu.org|access-date=January 13, 2022|archive-date=November 29, 2018|archive-url=https://web.archive.org/web/20181129002653/http://gcc.gnu.org/gcc-8/changes.html|url-status=live}}</ref>


GCC has been [[porting|ported]] to a wide variety of [[instruction set architecture]]s, and is widely deployed as a tool in the development of both free and [[proprietary software]]. GCC is also available for many [[embedded system]]s, including [[Symbian]] (called ''gcce''),<ref>{{cite web|url=http://www.inf.u-szeged.hu/symbian-gcc/|title=Symbian GCC Improvement Project|access-date=2007-11-08 }}</ref> [[ARM architecture family|ARM]]-based, and [[Power ISA]]-based chips.<ref name="Linux Board Support Packages">{{cite web|last=|first=|date=|title=Linux Board Support Packages|url=http://www.freescale.com/webapp/sps/site/overview.jsp?code=CW_BSP&fsrch=1|url-status=dead|archive-url=https://web.archive.org/web/20110607140609/http://www.freescale.com/webapp/sps/site/overview.jsp?code=CW_BSP&fsrch=1|archive-date=2011-06-07|access-date=2021-01-24|website=}}</ref> The compiler can target a wide variety of platforms, including [[video game console]]s such as the [[PlayStation 2]],<ref name=":3">{{cite web|url=http://ps2stuff.playstation2-linux.com/gcc_build.html |title=setting up gcc as a cross-compiler |work=ps2stuff |date=2002-06-08 |access-date=2008-12-12 |url-status=dead |archive-url=https://web.archive.org/web/20081211044658/http://ps2stuff.playstation2-linux.com/gcc_build.html |archive-date=December 11, 2008 }}</ref> Cell SPE of PlayStation 3,<ref name=":4">{{Cite web|url=https://gcc.gnu.org/wiki/CompileFarm|title=CompileFarm - GCC Wiki|website=gcc.gnu.org}}</ref> and [[Dreamcast]].<ref name=":5">{{cite web |url=http://www.ngine.de/gccguide.html |title=sh4 g++ guide |archive-url=https://web.archive.org/web/20021220025554/http://www.ngine.de/gccguide.html |archive-date=2002-12-20 |access-date=2008-12-12 }}</ref> It has been ported to more kinds of [[central processing unit|processors]] and operating systems than any other compiler.<ref name=":1">{{cite web|last=|first=|date=|title=Linux Information Project|url=http://www.linfo.org/gcc.html|access-date=2010-04-27|website=|publisher=LINFO|quote=The GCC has been ported to (i.e., modified to run on) more than 60 platforms, which is more than for any other compiler.}}</ref>{{Self-published inline|date=January 2021}}{{Better source needed|date=January 2021}}
GCC has been [[porting|ported]] to a wide variety of [[instruction set architecture]]s, and is widely deployed as a tool in the development of both free and [[proprietary software]]. GCC is also available for many [[embedded system]]s, including [[Symbian]] (called ''gcce''),<ref>{{cite web|url=http://www.inf.u-szeged.hu/symbian-gcc/|title=Symbian GCC Improvement Project|access-date=2007-11-08|archive-date=August 1, 2014|archive-url=https://web.archive.org/web/20140801121616/http://www.inf.u-szeged.hu/symbian-gcc/|url-status=live}}</ref> [[ARM architecture family|ARM]]-based, and [[Power ISA]]-based chips.<ref name="Linux Board Support Packages">{{cite web|last=|first=|date=|title=Linux Board Support Packages|url=http://www.freescale.com/webapp/sps/site/overview.jsp?code=CW_BSP&fsrch=1|url-status=dead|archive-url=https://web.archive.org/web/20110607140609/http://www.freescale.com/webapp/sps/site/overview.jsp?code=CW_BSP&fsrch=1|archive-date=2011-06-07|access-date=2021-01-24|website=}}</ref> The compiler can target a wide variety of platforms, including [[video game console]]s such as the [[PlayStation 2]],<ref name=":3">{{cite web|url=http://ps2stuff.playstation2-linux.com/gcc_build.html |title=setting up gcc as a cross-compiler |work=ps2stuff |date=2002-06-08 |access-date=2008-12-12 |url-status=dead |archive-url=https://web.archive.org/web/20081211044658/http://ps2stuff.playstation2-linux.com/gcc_build.html |archive-date=December 11, 2008 }}</ref> Cell SPE of PlayStation 3,<ref name=":4">{{Cite web|url=https://gcc.gnu.org/wiki/CompileFarm|title=CompileFarm - GCC Wiki|website=gcc.gnu.org|access-date=September 19, 2016|archive-date=January 18, 2023|archive-url=https://web.archive.org/web/20230118185814/https://gcc.gnu.org/wiki/CompileFarm|url-status=live}}</ref> and [[Dreamcast]].<ref name=":5">{{cite web |url=http://www.ngine.de/gccguide.html |title=sh4 g++ guide |archive-url=https://web.archive.org/web/20021220025554/http://www.ngine.de/gccguide.html |archive-date=2002-12-20 |access-date=2008-12-12 }}</ref> It has been ported to more kinds of [[central processing unit|processors]] and operating systems than any other compiler.<ref name=":1">{{cite web|last=|first=|date=|title=Linux Information Project|url=http://www.linfo.org/gcc.html|access-date=2010-04-27|website=|publisher=LINFO|quote=The GCC has been ported to (i.e., modified to run on) more than 60 platforms, which is more than for any other compiler.|archive-date=January 3, 2023|archive-url=https://web.archive.org/web/20230103063841/http://www.linfo.org/gcc.html|url-status=live}}</ref>{{Self-published inline|date=January 2021}}{{Better source needed|date=January 2021}}


== Supported languages ==
== Supported languages ==
{{As of|2021|May}}, the recent 11.1 release of GCC includes front ends for [[C (programming language)|C]] (<code>gcc</code>), [[C++]] (<code>g++</code>), [[Objective-C]], [[Fortran]] (<code>[[gfortran]]</code>), [[Ada (programming language)|Ada]] ([[GNAT]]), [[Go (programming language)|Go]] (<code>gccgo</code>) and [[D (programming language)|D]] (<code>gdc</code>, since 9.1)<ref>{{Cite web|title=The D Language Front-End Finally Merged Into GCC 9 - Phoronix|url=https://phoronix.com/scan.php?page=news_item&px=GCC-9-Merges-D-Language|access-date=2021-01-19|website=phoronix.com}}</ref> programming languages,<ref name=":7">{{cite web|url=https://gcc.gnu.org/frontends.html|title=GCC Front Ends|publisher=gnu.org|access-date=November 25, 2011}}</ref> with the [[OpenMP]] and [[OpenACC]] parallel language extensions being supported since GCC 5.1.<ref name=":2" /><ref>{{Cite web|url=https://gcc.gnu.org/gcc-5/changes.html|title=GCC 5 Release Series — Changes, New Features, and Fixes - GNU Project|website=gcc.gnu.org}}</ref> Versions prior to GCC 7 also supported [[Java (programming language)|Java]] (<code>[[GNU Compiler for Java|gcj]]</code>), allowing compilation of Java to native machine code.<ref>{{cite web|title=GCC 7 Release Series|url=https://gcc.gnu.org/gcc-7/changes.html|access-date=March 20, 2018|publisher=gnu.org}}</ref><!-- objective C++ was supported for some time, but when exactly? -->
{{As of|alt=As of the 13.1 release| 2023|04|post=,}} GCC includes front ends for [[C (programming language)|C]] (<code>gcc</code>), [[C++]] (<code>g++</code>), [[Objective-C]] and [[Objective-C#Objective-C++|Objective-C++]], [[Fortran]] (<code>[[gfortran]]</code>), [[Ada (programming language)|Ada]] ([[GNAT]]), [[Go (programming language)|Go]] (<code>gccgo</code>), [[D (programming language)|D]] (<code>gdc</code>, since 9.1),<ref>{{cite web | url=https://gcc.gnu.org/gcc-9/changes.html#d | title=GCC 9 Release Series — Changes, New Features, and Fixes - GNU Project | access-date=May 7, 2019 | archive-date=February 19, 2022 | archive-url=https://web.archive.org/web/20220219120525/https://gcc.gnu.org/gcc-9/changes.html#d | url-status=live }}</ref><ref>{{Cite web|title=The D Language Front-End Finally Merged Into GCC 9 - Phoronix|url=https://phoronix.com/scan.php?page=news_item&px=GCC-9-Merges-D-Language|access-date=2021-01-19|website=phoronix.com|archive-date=May 17, 2022|archive-url=https://web.archive.org/web/20220517184343/https://www.phoronix.com/scan.php?page=news_item&px=GCC-9-Merges-D-Language|url-status=live}}</ref> and [[Modula-2]] (<code>gm2</code>, since 13.1)<ref>{{cite web | url=https://gcc.gnu.org/gcc-13/changes.html#modula2 | title=GCC 13 Release Series — Changes, New Features, and Fixes - GNU Project | access-date=June 23, 2023 | archive-date=May 26, 2023 | archive-url=https://web.archive.org/web/20230526084642/http://gcc.gnu.org/gcc-13/changes.html#modula2 | url-status=live }}</ref><ref>{{Cite web |url=https://www.theregister.com/2022/12/16/gcc_13_will_support_modula2/ |title=GCC 13 to support Modula-2: Follow-up to Pascal lives on in FOSS form |date=2022-12-16 |access-date=2022-12-19 |last=Proven |first=Liam |archive-date=December 19, 2022 |archive-url=https://web.archive.org/web/20221219080641/https://www.theregister.com/2022/12/16/gcc_13_will_support_modula2/ |url-status=live }}</ref> programming languages,<ref name=":7">{{cite web|url=https://gcc.gnu.org/frontends.html|title=GCC Front Ends|publisher=gnu.org|access-date=November 25, 2011|archive-date=January 18, 2023|archive-url=https://web.archive.org/web/20230118185814/https://gcc.gnu.org/frontends.html|url-status=live}}</ref> with the [[OpenMP]] and [[OpenACC]] parallel language extensions being supported since GCC 5.1.<ref name=":2" /><ref>{{Cite web|url=https://gcc.gnu.org/gcc-5/changes.html|title=GCC 5 Release Series — Changes, New Features, and Fixes - GNU Project|website=gcc.gnu.org|access-date=April 23, 2015|archive-date=January 18, 2023|archive-url=https://web.archive.org/web/20230118185814/https://gcc.gnu.org/gcc-5/changes.html|url-status=live}}</ref> Versions prior to GCC 7 also supported [[Java (programming language)|Java]] (<code>[[GNU Compiler for Java|gcj]]</code>), allowing compilation of Java to native machine code.<ref>{{cite web|title=GCC 7 Release Series|url=https://gcc.gnu.org/gcc-7/changes.html|access-date=March 20, 2018|publisher=gnu.org|archive-date=September 2, 2020|archive-url=https://web.archive.org/web/20200902223230/https://gcc.gnu.org/gcc-7/changes.html|url-status=live}}</ref>


Regarding language version support for C++ and C, since GCC 11.1 the default target is ''gnu++17'', a superset of [[C++17]], and ''gnu11'', a superset of [[C11 (C standard revision)|C11]], with strict standard support also available. GCC also provides experimental support for [[C++20]] and upcoming [[C++23]].<ref>{{Cite web|title=C++ Standards Support in GCC|url=https://gcc.gnu.org/projects/cxx-status.html|access-date=May 17, 2021}}</ref>
Regarding language version support for C++ and C, since GCC 11.1 the default target is ''gnu++17'', a superset of [[C++17]], and ''gnu11'', a superset of [[C11 (C standard revision)|C11]], with strict standard support also available. GCC also provides experimental support for [[C++20]] and [[C++23]].<ref>{{Cite web|title=C++ Standards Support in GCC|url=https://gcc.gnu.org/projects/cxx-status.html|access-date=May 17, 2021|archive-date=April 20, 2022|archive-url=https://web.archive.org/web/20220420114133/https://gcc.gnu.org/projects/cxx-status.html|url-status=live}}</ref>


Third-party front ends exist for many languages, such as [[Pascal (programming language)|Pascal]] (<code>[[GNU Pascal|gpc]]</code>), [[Modula-2]], [[Modula-3]], and [[VHDL]] (<code>GHDL</code>).<ref name=":7" /> A few experimental branches exist to support additional languages, such as the GCC [[Unified Parallel C|UPC]] compiler for [[Unified Parallel C]]<ref>{{cite web|url=http://www.gccupc.org/|title=GCC UPC (GCC Unified Parallel C)|publisher=Intrepid Technology, Inc.|date=2006-02-20|access-date=2009-03-11}}</ref> or [[Rust (programming language)|Rust]].<ref>{{Cite web|last=Spengler|first=Brad|date=12 January 2021|title=Open Source Security, Inc. Announces Funding of GCC Front-End for Rust|url=https://opensrcsec.com/open_source_security_announces_rust_gcc_funding|access-date=|website=}}</ref>{{Better source needed|date=January 2021}}
Third-party front ends exist for many languages, such as [[Pascal (programming language)|Pascal]] (<code>[[GNU Pascal|gpc]]</code>), [[Modula-3]], and [[VHDL]] (<code>GHDL</code>).<ref name=":7" /> A few experimental branches exist to support additional languages, such as the GCC [[Unified Parallel C|UPC]] compiler for [[Unified Parallel C]]<ref>{{cite web|url=http://www.gccupc.org/|title=GCC UPC (GCC Unified Parallel C)|publisher=Intrepid Technology, Inc.|date=2006-02-20|access-date=2009-03-11|archive-date=February 11, 2010|archive-url=https://web.archive.org/web/20100211142352/http://www.gccupc.org/|url-status=dead}}</ref> or [[Rust (programming language)|Rust]].<ref>{{Cite web|title=GCC Front-End For Rust|url=https://rust-gcc.github.io/|access-date=Jan 6, 2023|archive-date=January 10, 2023|archive-url=https://web.archive.org/web/20230110130120/https://rust-gcc.github.io/|url-status=live}}</ref><ref>{{Cite web|title=GCC Front-End for Rust (Github)|website=[[GitHub]]|date=January 5, 2023|url=https://github.com/Rust-GCC/gccrs|access-date=Jan 6, 2023|archive-date=January 6, 2023|archive-url=https://web.archive.org/web/20230106134124/https://github.com/Rust-GCC/gccrs|url-status=live}}</ref><ref>{{Cite web|last=Spengler|first=Brad|date=12 January 2021|title=Open Source Security, Inc. Announces Funding of GCC Front-End for Rust|url=https://opensrcsec.com/open_source_security_announces_rust_gcc_funding|access-date=|website=|archive-date=April 25, 2021|archive-url=https://web.archive.org/web/20210425170408/https://opensrcsec.com/open_source_security_announces_rust_gcc_funding|url-status=live}}</ref>{{Better source needed|date=January 2021}}


== Design ==
== Design ==
[[File:Preprocessor.png|thumb|400x400px|Overview of GCC's extended compilation pipeline, including specialized programs like the [[preprocessor]], [[Assembly language|assembler]] and [[Linker (computing)|linker]].]][[File:Compiler design.svg|thumb|400x400px|GCC follows the 3-stage architecture typical of multi-language and multi-CPU [[compiler]]s. All [[Abstract syntax tree|program trees]] are converted to a common abstract representation at the "middle end", allowing [[Program optimization|code optimization]] and [[binary code]] generation facilities to be shared by all languages.]]
[[File:GCC Translation Diagram.jpg|thumb|400x400px|Overview of GCC's extended compilation pipeline, including specialized programs like the [[preprocessor]], [[Assembly language|assembler]] and [[Linker (computing)|linker]].]]
[[File:Compiler design.svg|thumb|400x400px|GCC follows the 3-stage architecture typical of multi-language and multi-CPU [[compiler]]s. All [[Abstract syntax tree|program trees]] are converted to a common abstract representation at the "middle end", allowing [[Program optimization|code optimization]] and [[binary code]] generation facilities to be shared by all languages.]]


GCC's external interface follows [[Unix]] conventions. Users invoke a language-specific driver program (<code>gcc</code> for C, <code>g++</code> for C++, etc.), which interprets [[Command-line argument|command arguments]], calls the actual compiler, runs the [[Assembly language assembler|assembler]] on the output, and then optionally runs the [[Linker (computing)|linker]] to produce a complete [[executable]] binary.
GCC's external interface follows [[Unix]] conventions. Users invoke a language-specific driver program (<code>gcc</code> for C, <code>g++</code> for C++, etc.), which interprets [[Command-line argument|command arguments]], calls the actual compiler, runs the [[Assembly language assembler|assembler]] on the output, and then optionally runs the [[Linker (computing)|linker]] to produce a complete [[executable]] binary.
Line 72: Line 73:
Each of the language compilers is a separate program that reads source code and outputs [[machine code]]. All have a common internal structure. A per-language front end [[parsing|parses]] the source code in that language and produces an [[abstract syntax tree]] ("tree" for short).
Each of the language compilers is a separate program that reads source code and outputs [[machine code]]. All have a common internal structure. A per-language front end [[parsing|parses]] the source code in that language and produces an [[abstract syntax tree]] ("tree" for short).


These are, if necessary, converted to the middle end's input representation, called ''GENERIC'' form; the middle end then gradually transforms the program towards its final form. [[Compiler optimization]]s and [[static code analysis]] techniques (such as FORTIFY_SOURCE,<ref>{{cite web|url=http://fedoraproject.org/wiki/Security/Features |title=Security Features: Compile Time Buffer Checks (FORTIFY_SOURCE) |publisher=fedoraproject.org |access-date=2009-03-11 }}</ref> a compiler directive that attempts to discover some [[buffer overflow]]s) are applied to the code. These work on multiple representations, mostly the architecture-independent GIMPLE representation and the architecture-dependent [[register transfer language|RTL]] representation. Finally, [[machine code]] is produced using architecture-specific [[pattern matching]] originally based on an algorithm of Jack Davidson and Chris Fraser.
These are, if necessary, converted to the middle end's input representation, called ''GENERIC'' form; the middle end then gradually transforms the program towards its final form. [[Compiler optimization]]s and [[static code analysis]] techniques (such as FORTIFY_SOURCE,<ref>{{cite web |url=http://fedoraproject.org/wiki/Security/Features |title=Security Features: Compile Time Buffer Checks (FORTIFY_SOURCE) |publisher=fedoraproject.org |access-date=2009-03-11 |archive-date=January 7, 2007 |archive-url=https://web.archive.org/web/20070107153447/http://fedoraproject.org/wiki/Security/Features |url-status=live }}</ref> a compiler directive that attempts to discover some [[buffer overflow]]s) are applied to the code. These work on multiple representations, mostly the architecture-independent GIMPLE representation and the architecture-dependent [[register transfer language|RTL]] representation. Finally, [[machine code]] is produced using architecture-specific [[pattern matching]] originally based on an algorithm of Jack Davidson and Chris Fraser.


GCC was written primarily in [[C (programming language)|C]] except for parts of the [[Ada (programming language)|Ada]] front end. The distribution includes the standard libraries for Ada and [[C++]] whose code is mostly written in those languages.<ref>{{cite web | url = http://www.ohloh.net/projects/gcc/analyses/latest | title = languages used to make GCC }}</ref><!-- primary source --> On some platforms, the distribution also includes a low-level runtime library, '''libgcc''', written in a combination of machine-independent C and processor-specific [[machine code]], designed primarily to handle arithmetic operations that the target processor cannot perform directly.<ref>{{cite web|url=https://gcc.gnu.org/onlinedocs/gccint/Libgcc.html|title=GCC Internals|publisher=GCC.org|access-date=March 1, 2010}}</ref>
GCC was written primarily in [[C (programming language)|C]] except for parts of the [[Ada (programming language)|Ada]] front end. The distribution includes the standard libraries for Ada and [[C++]] whose code is mostly written in those languages.<ref>{{cite web |title=languages used to make GCC |url=http://www.ohloh.net/projects/gcc/analyses/latest |url-status=dead |archive-url=https://web.archive.org/web/20080527213819/http://www.ohloh.net/projects/gcc/analyses/latest |archive-date=May 27, 2008 |access-date=14 September 2008}}</ref>{{Update inline|date=January 2023|reason=The first time the reference was used is 2008. It seems it hasn't been updated for a long time. (A reference to the Java compiler was removed in 2021, but the rest of the paragraph hasn't been changed at least since 2013.)}} On some platforms, the distribution also includes a low-level runtime library, '''libgcc''', written in a combination of machine-independent C and processor-specific [[machine code]], designed primarily to handle arithmetic operations that the target processor cannot perform directly.<ref>{{cite web|url=https://gcc.gnu.org/onlinedocs/gccint/Libgcc.html|title=GCC Internals|publisher=GCC.org|access-date=March 1, 2010|archive-date=January 18, 2023|archive-url=https://web.archive.org/web/20230118185814/https://gcc.gnu.org/onlinedocs/gccint/Libgcc.html|url-status=live}}</ref>


GCC uses many additional tools in its build, many of which are installed by default by many Unix and Linux distributions (but which, normally, aren't present in Windows installations), including [[Perl]],{{Explain|reason=|date=January 2021}} [[Flex lexical analyser|Flex]], [[GNU bison|Bison]], and other common tools. In addition, it currently requires three additional libraries to be present in order to build: [[GNU Multi-Precision Library|GMP]], [[Multiple Precision Complex|MPC]], and [[MPFR]].<ref>{{Cite web|title=Prerequisites for GCC - GNU Project|url=https://gcc.gnu.org/install/prerequisites.html|access-date=2021-09-05|website=gcc.gnu.org}}</ref>
GCC uses many additional tools in its build, many of which are installed by default by many Unix and Linux distributions (but which, normally, aren't present in Windows installations), including [[Perl]],{{Explain|reason=|date=January 2021}} [[Flex lexical analyser|Flex]], [[GNU bison|Bison]], and other common tools. In addition, it currently requires three additional libraries to be present in order to build: [[GNU Multi-Precision Library|GMP]], [[Multiple Precision Complex|MPC]], and [[MPFR]].<ref>{{Cite web|title=Prerequisites for GCC - GNU Project|url=https://gcc.gnu.org/install/prerequisites.html|access-date=2021-09-05|website=gcc.gnu.org|archive-date=January 18, 2023|archive-url=https://web.archive.org/web/20230118185814/https://gcc.gnu.org/install/prerequisites.html|url-status=live}}</ref>


In May 2010, the GCC steering committee decided to allow use of a [[C++]] compiler to compile GCC.<ref name="gcc-c++">{{cite news | title = GCC allows C++&nbsp;– to some degree | url = http://www.h-online.com/open/news/item/GCC-allows-C-to-some-degree-1012611.html | publisher = [[Heinz Heise|The H]] |date=June 1, 2010 }}</ref> The compiler was intended to be written mostly in C plus a subset of features from C++. In particular, this was decided so that GCC's developers could use the [[Destructor (computer science)|destructors]] and [[Generic programming|generics]] features of C++.<ref>{{Cite web|url=https://lists.gnu.org/archive/html/emacs-devel/2010-07/msg00518.html|title=Re: Efforts to attract more users?|website=lists.gnu.org}}</ref>
In May 2010, the GCC steering committee decided to allow use of a [[C++]] compiler to compile GCC.<ref name="gcc-c++">{{cite news | title = GCC allows C++&nbsp;– to some degree | url = http://www.h-online.com/open/news/item/GCC-allows-C-to-some-degree-1012611.html | publisher = [[Heinz Heise|The H]] | date = June 1, 2010 | access-date = June 9, 2010 | archive-date = September 26, 2022 | archive-url = https://web.archive.org/web/20220926160308/http://www.h-online.com/open/news/item/GCC-allows-C-to-some-degree-1012611.html | url-status = live }}</ref> The compiler was intended to be written mostly in C plus a subset of features from C++. In particular, this was decided so that GCC's developers could use the [[Destructor (computer science)|destructors]] and [[Generic programming|generics]] features of C++.<ref>{{Cite web|url=https://lists.gnu.org/archive/html/emacs-devel/2010-07/msg00518.html|title=Re: Efforts to attract more users?|website=lists.gnu.org|access-date=September 24, 2021|archive-date=January 18, 2023|archive-url=https://web.archive.org/web/20230118185909/https://lists.gnu.org/archive/html/emacs-devel/2010-07/msg00518.html|url-status=live}}</ref>


In August 2012, the GCC steering committee announced that GCC now uses C++ as its implementation language.<ref>{{cite web|title=GCC 4.8 Release Series: Changes, New Features, and Fixes|url=https://gcc.gnu.org/gcc-4.8/changes.html|access-date=October 4, 2013}}</ref> This means that to build GCC from sources, a C++ compiler is required that understands [[C++03|ISO/IEC C++03]] standard.
In August 2012, the GCC steering committee announced that GCC now uses C++ as its implementation language.<ref>{{cite web|title=GCC 4.8 Release Series: Changes, New Features, and Fixes|url=https://gcc.gnu.org/gcc-4.8/changes.html|access-date=October 4, 2013|archive-date=December 8, 2015|archive-url=https://web.archive.org/web/20151208064435/https://gcc.gnu.org/gcc-4.8/changes.html|url-status=live}}</ref> This means that to build GCC from sources, a C++ compiler is required that understands [[C++03|ISO/IEC C++03]] standard.


On May 18, 2020, GCC moved away from [[C++03|ISO/IEC C++03]] standard to [[C++11|ISO/IEC C++11]] standard (i.e. needed to compile, bootstrap, the compiler itself; by default it however compiles later versions of C++).<ref>{{cite web|title=bootstrap: Update requirement to C++11.|website=[[GitHub]] |url=https://github.com/gcc-mirror/gcc/commit/5329b59a2e13dabbe2038af0fe2e3cf5fc7f98ed|access-date=May 18, 2020}}</ref>
On May 18, 2020, GCC moved away from [[C++03|ISO/IEC C++03]] standard to [[C++11|ISO/IEC C++11]] standard (i.e. needed to compile, bootstrap, the compiler itself; by default it however compiles later versions of C++).<ref>{{cite web|title=bootstrap: Update requirement to C++11.|website=[[GitHub]]|url=https://github.com/gcc-mirror/gcc/commit/5329b59a2e13dabbe2038af0fe2e3cf5fc7f98ed|access-date=May 18, 2020|archive-date=September 29, 2022|archive-url=https://web.archive.org/web/20220929120518/https://github.com/gcc-mirror/gcc/commit/5329b59a2e13dabbe2038af0fe2e3cf5fc7f98ed|url-status=live}}</ref>


=== Front ends ===
=== Front ends ===
Line 88: Line 89:
[[File:Xxx Scanner and parser example for C.gif|thumb|right|300px|Front ends consist of [[Preprocessor|preprocessing]], [[lexical analysis]], [[Parsing|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 (programming language)|C]].]]
[[File:Xxx Scanner and parser example for C.gif|thumb|right|300px|Front ends consist of [[Preprocessor|preprocessing]], [[lexical analysis]], [[Parsing|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 (programming language)|C]].]]


Each [[front end (compiler)|front end]] uses a parser to produce the [[abstract syntax tree]] of a given [[source file]]. Due to the syntax tree abstraction, source files of any of the different supported languages can be processed by the same [[back end (Compiler)|back end]]. GCC started out using [[LALR parser]]s generated with [[GNU Bison|Bison]], but gradually switched to hand-written [[Recursive descent parser|recursive-descent parsers]] for C++ in 2004,<ref>{{Cite web|url=https://gcc.gnu.org/gcc-3.4/changes.html|title=GCC 3.4 Release Series — Changes, New Features, and Fixes - GNU Project|website=gcc.gnu.org}}</ref> and for C and Objective-C in 2006.<ref>{{Cite web|url=https://gcc.gnu.org/gcc-4.1/changes.html|title=GCC 4.1 Release Series — Changes, New Features, and Fixes - GNU Project|website=gcc.gnu.org}}</ref> As of 2021 all front ends use hand-written recursive-descent parsers.
Each [[front end (compiler)|front end]] uses a parser to produce the [[abstract syntax tree]] of a given [[source file]]. Due to the syntax tree abstraction, source files of any of the different supported languages can be processed by the same [[back end (Compiler)|back end]]. GCC started out using [[LALR parser]]s generated with [[GNU Bison|Bison]], but gradually switched to hand-written [[Recursive descent parser|recursive-descent parsers]] for C++ in 2004,<ref>{{Cite web|url=https://gcc.gnu.org/gcc-3.4/changes.html|title=GCC 3.4 Release Series — Changes, New Features, and Fixes - GNU Project|website=gcc.gnu.org|access-date=July 25, 2016|archive-date=January 18, 2023|archive-url=https://web.archive.org/web/20230118185814/https://gcc.gnu.org/gcc-3.4/changes.html|url-status=live}}</ref> and for C and Objective-C in 2006.<ref>{{Cite web|url=https://gcc.gnu.org/gcc-4.1/changes.html|title=GCC 4.1 Release Series — Changes, New Features, and Fixes - GNU Project|website=gcc.gnu.org|access-date=July 25, 2016|archive-date=January 18, 2023|archive-url=https://web.archive.org/web/20230118185814/https://gcc.gnu.org/gcc-4.1/changes.html|url-status=live}}</ref> As of 2021 all front ends use hand-written recursive-descent parsers.


Until GCC 4.0 the tree representation of the program was not fully independent of the processor being targeted. The meaning of a tree was somewhat different for different language front ends, and front ends could provide their own tree codes. This was simplified with the introduction of GENERIC and GIMPLE, two new forms of language-independent trees that were introduced with the advent of GCC 4.0. GENERIC is more complex, based on the GCC 3.x Java front end's intermediate representation. GIMPLE is a simplified GENERIC, in which various constructs are ''[[lowering (computer science)|lowered]]'' to multiple GIMPLE instructions. The [[C (Programming Language)|C]], [[C++]], and [[Java (programming language)|Java]] front ends produce GENERIC directly in the front end. Other front ends instead have different intermediate representations after parsing and convert these to GENERIC.
Until GCC 4.0 the tree representation of the program was not fully independent of the processor being targeted. The meaning of a tree was somewhat different for different language front ends, and front ends could provide their own tree codes. This was simplified with the introduction of GENERIC and GIMPLE, two new forms of language-independent trees that were introduced with the advent of GCC 4.0. GENERIC is more complex, based on the GCC 3.x Java front end's intermediate representation. GIMPLE is a simplified GENERIC, in which various constructs are ''[[lowering (computer science)|lowered]]'' to multiple GIMPLE instructions. The [[C (Programming Language)|C]], [[C++]], and [[Java (programming language)|Java]] front ends produce GENERIC directly in the front end. Other front ends instead have different intermediate representations after parsing and convert these to GENERIC.
Line 97: Line 98:
''GENERIC'' is an [[intermediate representation]] language used as a "middle end" while compiling source code into [[executable|executable binaries]]. A subset, called ''GIMPLE'', is targeted by all the front ends of GCC.
''GENERIC'' is an [[intermediate representation]] language used as a "middle end" while compiling source code into [[executable|executable binaries]]. A subset, called ''GIMPLE'', is targeted by all the front ends of GCC.


The middle stage of GCC does all of the code analysis and [[optimizing compiler|optimization]], working independently of both the compiled language and the target architecture, starting from the GENERIC<ref>{{Cite web|url=https://gcc.gnu.org/onlinedocs/gccint/GENERIC.html|title=GENERIC (GNU Compiler Collection (GCC) Internals)|website=gcc.gnu.org}}</ref> representation and expanding it to [[register transfer language]] (RTL). The GENERIC representation contains only the subset of the imperative [[computer programming|programming]] constructs optimized by the middle end.
The middle stage of GCC does all of the code analysis and [[optimizing compiler|optimization]], working independently of both the compiled language and the target architecture, starting from the GENERIC<ref>{{Cite web|url=https://gcc.gnu.org/onlinedocs/gccint/GENERIC.html|title=GENERIC (GNU Compiler Collection (GCC) Internals)|website=gcc.gnu.org|access-date=July 25, 2016|archive-date=January 18, 2023|archive-url=https://web.archive.org/web/20230118185814/https://gcc.gnu.org/onlinedocs/gccint/GENERIC.html|url-status=live}}</ref> representation and expanding it to [[register transfer language]] (RTL). The GENERIC representation contains only the subset of the imperative [[computer programming|programming]] constructs optimized by the middle end.


In transforming the source code to GIMPLE,<ref>{{Cite web|url=https://gcc.gnu.org/onlinedocs/gccint/GIMPLE.html|title=GIMPLE (GNU Compiler Collection (GCC) Internals)|website=gcc.gnu.org}}</ref> complex [[Expression (programming)|expressions]] are split into a [[three-address code]] using [[temporary variable]]s. This representation was inspired by the SIMPLE representation proposed in the McCAT compiler<ref>{{cite web |url=http://www-acaps.cs.mcgill.ca/info/McCAT/McCAT.html |title=McCAT |access-date=2017-09-14 |url-status=bot: unknown |archive-url=https://web.archive.org/web/20040812030043/http://www-acaps.cs.mcgill.ca/info/McCAT/McCAT.html |archive-date=August 12, 2004 |df=mdy-all }}</ref> by Laurie J. Hendren<ref>{{Cite web|url=http://www.sable.mcgill.ca/~hendren/|title=Laurie Hendren's Home Page|website=www.sable.mcgill.ca}}</ref> for simplifying the analysis and [[Optimization (computer science)|optimization]] of [[Imperative programming|imperative programs]].
In transforming the source code to GIMPLE,<ref>{{Cite web|url=https://gcc.gnu.org/onlinedocs/gccint/GIMPLE.html|title=GIMPLE (GNU Compiler Collection (GCC) Internals)|website=gcc.gnu.org|access-date=July 25, 2016|archive-date=January 18, 2023|archive-url=https://web.archive.org/web/20230118185814/https://gcc.gnu.org/onlinedocs/gccint/GIMPLE.html|url-status=live}}</ref> complex [[Expression (programming)|expressions]] are split into a [[three-address code]] using [[temporary variable]]s. This representation was inspired by the SIMPLE representation proposed in the McCAT compiler<ref>{{cite web |url=http://www-acaps.cs.mcgill.ca/info/McCAT/McCAT.html |title=McCAT |access-date=2017-09-14 |url-status=bot: unknown |archive-url=https://web.archive.org/web/20040812030043/http://www-acaps.cs.mcgill.ca/info/McCAT/McCAT.html |archive-date=August 12, 2004 |df=mdy-all }}</ref> by Laurie J. Hendren<ref>{{Cite web|url=http://www.sable.mcgill.ca/~hendren/|title=Laurie Hendren's Home Page|website=www.sable.mcgill.ca|access-date=July 20, 2009|archive-date=September 27, 2022|archive-url=https://web.archive.org/web/20220927074148/http://www.sable.mcgill.ca/~hendren/|url-status=live}}</ref> for simplifying the analysis and [[Optimization (computer science)|optimization]] of [[Imperative programming|imperative programs]].


=== Optimization ===
=== Optimization ===
Optimization can occur during any phase of compilation; however, the bulk of optimizations are performed after the syntax and [[Semantic analysis (compiler)|semantic analysis]] of the front end and before the [[Code generation (compiler)|code generation]] of the back end; thus a common, even though somewhat contradictory, name for this part of the compiler is the "middle end."
Optimization can occur during any phase of compilation; however, the bulk of optimizations are performed after the syntax and [[Semantic analysis (compiler)|semantic analysis]] of the front end and before the [[Code generation (compiler)|code generation]] of the back end; thus a common, though somewhat self-contradictory, name for this part of the compiler is the "middle end."


The exact set of GCC optimizations varies from release to release as it develops, but includes the standard algorithms, such as [[loop optimization]], [[jump threading]], [[common subexpression elimination]], [[instruction scheduling]], and so forth. The [[Register transfer language|RTL]] optimizations are of less importance with the addition of global SSA-based optimizations on [[GIMPLE]] trees,<ref>{{cite web|url=http://www.redhat.com/magazine/002dec04/features/gcc/|title=From Source to Binary: The Inner Workings of GCC|last=Novillo|first=Diego|work=[[Red Hat#Red Hat Magazine|Red Hat Magazine]]|date=December 2004|url-status=dead|archive-url=https://web.archive.org/web/20090401215553/http://www.redhat.com/magazine/002dec04/features/gcc/|archive-date=April 1, 2009|df=mdy-all}}</ref> as RTL optimizations have a much more limited scope, and have less high-level information.
The exact set of GCC optimizations varies from release to release as it develops, but includes the standard algorithms, such as [[loop optimization]], [[jump threading]], [[common subexpression elimination]], [[instruction scheduling]], and so forth. The [[Register transfer language|RTL]] optimizations are of less importance with the addition of global SSA-based optimizations on [[GIMPLE]] trees,<ref>{{cite web|url=http://www.redhat.com/magazine/002dec04/features/gcc/|title=From Source to Binary: The Inner Workings of GCC|last=Novillo|first=Diego|work=[[Red Hat#Opensource.com|Red Hat Magazine]]|date=December 2004|url-status=dead|archive-url=https://web.archive.org/web/20090401215553/http://www.redhat.com/magazine/002dec04/features/gcc/|archive-date=April 1, 2009|df=mdy-all}}</ref> as RTL optimizations have a much more limited scope, and have less high-level information.


Some of these optimizations performed at this level include [[dead-code elimination]], [[partial-redundancy elimination]], [[global value numbering]], [[sparse conditional constant propagation]], and [[scalar replacement of aggregates]]. Array dependence based optimizations such as [[automatic vectorization]] and [[automatic parallelization]] are also performed. [[Profile-guided optimization]] is also possible.<ref>{{Cite web|url=https://gcc.gnu.org/install/build.html#TOC4|title=Installing GCC: Building - GNU Project|website=gcc.gnu.org}}</ref>
Some of these optimizations performed at this level include [[dead-code elimination]], [[partial-redundancy elimination]], [[global value numbering]], [[sparse conditional constant propagation]], and [[scalar replacement of aggregates]]. Array dependence based optimizations such as [[automatic vectorization]] and [[automatic parallelization]] are also performed. [[Profile-guided optimization]] is also possible.<ref>{{Cite web|url=https://gcc.gnu.org/install/build.html#TOC4|title=Installing GCC: Building - GNU Project|website=gcc.gnu.org|access-date=July 25, 2016|archive-date=August 22, 2023|archive-url=https://web.archive.org/web/20230822141635/http://gcc.gnu.org/install/build.html#TOC4|url-status=live}}</ref>

=== Back end ===
{{unreferenced section|date=May 2020}}
The GCC's back end is partly specified by [[C preprocessor|preprocessor macros]] and functions specific to a target architecture, for instance to define its [[endianness]], [[word size]], and [[calling convention]]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. At any moment, the actual RTL instructions forming the program representation have to comply with the [[machine description]] of the target architecture.

The machine description file contains RTL patterns, along with operand constraints, and code snippets to output the final assembly. The constraints indicate that a particular RTL pattern might only apply (for example) to certain hardware registers, or (for example) allow immediate operand offsets of only a limited size (e.g. 12, 16, 24, ... bit offsets, etc.). During RTL generation, the constraints for the given target architecture are checked. In order to issue a given snippet of RTL, it must match one (or more) of the RTL patterns in the machine description file, and satisfy the constraints for that pattern; otherwise, it would be impossible to convert the final RTL into machine code.

Towards the end of compilation, valid RTL is reduced to a ''strict'' form in which each instruction refers to real machine registers and a pattern from the target's machine description file. Forming strict RTL is a complicated task; an important step is [[register allocation]], where real hardware registers are chosen to replace the initially assigned pseudo-registers. This is followed by a "reloading" phase; any pseudo-registers that were not assigned a real hardware register are 'spilled' to the stack, and RTL to perform this spilling is generated. Likewise, offsets that are too large to fit into an actual instruction must be broken up and replaced by RTL sequences that will obey the offset constraints.

In the final phase, the machine code is built by calling a small snippet of code, associated with each pattern, to generate the real instructions from the target's [[instruction set]], using the final registers, offsets, and addresses chosen during the reload phase. The assembly-generation snippet may be just a string, in which case a simple string substitution of the registers, offsets, and/or addresses into the string is performed. The assembly-generation snippet may also be a short block of C code, performing some additional work, but ultimately returning a string containing the valid assembly code.


=== C++ Standard Library (libstdc++) ===
=== C++ Standard Library (libstdc++) ===
The GCC project includes an implementation of the [[C++ Standard Library]] called libstdc++,<ref>{{cite web|url=https://gcc.gnu.org/onlinedocs/libstdc++|title=The GNU C++ Library|publisher=GNU Project|accessdate=2021-02-21}}</ref> licensed under the GPLv3 License with an exception to link closed source application when sources are built with GCC.<ref>{{cite web|url=https://gcc.gnu.org/onlinedocs/libstdc++/manual/license.html|title=License|publisher=GNU Project|accessdate=2021-02-21}}</ref>
The GCC project includes an implementation of the [[C++ Standard Library]] called libstdc++,<ref>{{cite web|url=https://gcc.gnu.org/onlinedocs/libstdc++|title=The GNU C++ Library|publisher=GNU Project|accessdate=2021-02-21|archive-date=December 25, 2022|archive-url=https://web.archive.org/web/20221225041607/https://gcc.gnu.org/onlinedocs/libstdc++/|url-status=live}}</ref> licensed under the GPLv3 License with an exception to link non-GPL applications when sources are built with GCC.<ref>{{cite web|url=https://gcc.gnu.org/onlinedocs/libstdc++/manual/license.html|title=License|publisher=GNU Project|accessdate=2021-02-21|archive-date=January 18, 2023|archive-url=https://web.archive.org/web/20230118185814/https://gcc.gnu.org/onlinedocs/libstdc++/manual/license.html|url-status=live}}</ref>
The current version is 11{{when|date=June 2022}}.


=== Other features ===
=== Other features ===
Line 128: Line 118:
: [[Link-time optimization]] optimizes across object file boundaries to directly improve the linked binary. Link-time optimization relies on an intermediate file containing the serialization of some ''Gimple'' representation included in the object file.{{Citation needed|date=January 2016}} The file is generated alongside the object file during source compilation. Each source compilation generates a separate object file and link-time helper file. When the object files are linked, the compiler is executed again and uses the helper files to optimize code across the separately compiled object files.
: [[Link-time optimization]] optimizes across object file boundaries to directly improve the linked binary. Link-time optimization relies on an intermediate file containing the serialization of some ''Gimple'' representation included in the object file.{{Citation needed|date=January 2016}} The file is generated alongside the object file during source compilation. Each source compilation generates a separate object file and link-time helper file. When the object files are linked, the compiler is executed again and uses the helper files to optimize code across the separately compiled object files.
; Plugins
; Plugins
: [[Plug-in (computing)|Plugins]] extend the GCC compiler directly.<ref>{{cite web |title= Plugins |url= https://gcc.gnu.org/onlinedocs/gccint/Plugins.html |work= GCC online documentation |access-date= July 8, 2013 }}</ref> Plugins allow a stock compiler to be tailored to specific needs by external code loaded as plugins. For example, plugins can add, replace, or even remove middle-end passes operating on ''Gimple'' representations.<ref>{{cite web|last=Starynkevitch|first=Basile|title=GCC plugins thru the MELT example|url=http://gcc-melt.org/gcc-plugin-MELT-LinuxCollabSummit2014.pdf |archive-url=https://web.archive.org/web/20140413124801/http://gcc-melt.org/gcc-plugin-MELT-LinuxCollabSummit2014.pdf |archive-date=2014-04-13 |url-status=live|access-date=2014-04-10}}</ref> Several GCC plugins have already been published, notably:
: [[Plug-in (computing)|Plugins]] extend the GCC compiler directly.<ref>{{cite web |title= Plugins |url= https://gcc.gnu.org/onlinedocs/gccint/Plugins.html |work= GCC online documentation |access-date= July 8, 2013 |archive-date= April 30, 2013 |archive-url= https://web.archive.org/web/20130430223330/http://gcc.gnu.org/onlinedocs/gccint/Plugins.html |url-status= live }}</ref> Plugins allow a stock compiler to be tailored to specific needs by external code loaded as plugins. For example, plugins can add, replace, or even remove middle-end passes operating on ''Gimple'' representations.<ref>{{cite web|last=Starynkevitch|first=Basile|title=GCC plugins thru the MELT example|url=http://gcc-melt.org/gcc-plugin-MELT-LinuxCollabSummit2014.pdf |archive-url=https://web.archive.org/web/20140413124801/http://gcc-melt.org/gcc-plugin-MELT-LinuxCollabSummit2014.pdf |archive-date=2014-04-13 |url-status=live|access-date=2014-04-10}}</ref> Several GCC plugins have already been published, notably:
:* The Python plugin, which links against libpython, and allows one to invoke arbitrary Python scripts from inside the compiler. The aim is to allow GCC plugins to be written in Python.
:* The Python plugin, which links against libpython, and allows one to invoke arbitrary Python scripts from inside the compiler. The aim is to allow GCC plugins to be written in Python.
:* The MELT plugin provides a high-level [[Lisp (programming language)|Lisp]]-like language to extend GCC.<ref>{{cite web|title=About GCC MELT|url=http://gcc-melt.org/|access-date=July 8, 2013|archive-url= https://archive.today/20130704015544/http://gcc-melt.org/|archive-date=July 4, 2013|url-status=live}}</ref>
:* The MELT plugin provides a high-level [[Lisp (programming language)|Lisp]]-like language to extend GCC.<ref>{{cite web|title=About GCC MELT|url=http://gcc-melt.org/|access-date=July 8, 2013|archive-url= https://archive.today/20130704015544/http://gcc-melt.org/|archive-date=July 4, 2013|url-status=live}}</ref>
: The support of plugins was once a contentious issue in 2007.<ref>{{cite web |title=GCC unplugged [LWN.net] |url=https://lwn.net/Articles/259157/ |website=lwn.net}}</ref>
: The support of plugins was once a contentious issue in 2007.<ref>{{cite web |title=GCC unplugged [LWN.net] |url=https://lwn.net/Articles/259157/ |website=lwn.net |access-date=March 28, 2021 |archive-date=November 9, 2020 |archive-url=https://web.archive.org/web/20201109001410/https://lwn.net/Articles/259157/ |url-status=live }}</ref>
; C++ [[Software transactional memory|transactional memory]]
; C++ [[Software transactional memory|transactional memory]]
: The C++ language has an active proposal for transactional memory. It can be enabled in GCC 6 and newer when compiling with <code>-fgnu-tm</code>.<ref name="gcc6"/><ref>{{Cite web|url=https://gcc.gnu.org/wiki/TransactionalMemory|title=TransactionalMemory - GCC Wiki|website=gcc.gnu.org}}</ref>
: The C++ language has an active proposal for transactional memory. It can be enabled in GCC 6 and newer when compiling with <code>-fgnu-tm</code>.<ref name="gcc6"/><ref>{{Cite web|url=https://gcc.gnu.org/wiki/TransactionalMemory|title=TransactionalMemory - GCC Wiki|website=gcc.gnu.org|access-date=September 19, 2016|archive-date=August 19, 2016|archive-url=https://web.archive.org/web/20160819055121/http://gcc.gnu.org/wiki/TransactionalMemory|url-status=live}}</ref>
; Unicode identifiers
; Unicode identifiers
: Although the C++ language requires support for non-ASCII [[Unicode characters]] in [[Identifier (computer languages)|identifiers]], the feature has only been supported since GCC 10. As with the existing handling of string literals, the source file is assumed to be encoded in [[UTF-8]]. The feature is optional in C, but has been made available too since this change.<ref>{{Cite web|url=https://gcc.gnu.org/legacy-ml/gcc-patches/2020-01/msg01667.html|title=Lewis Hyatt - [PATCH] wwwdocs: Document support for extended identifiers added to GCC|website=gcc.gnu.org|access-date=2020-03-27}}</ref><ref>{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3146.html|title=Recommendations for extended identifier characters for C and C++|website=www.open-std.org|access-date=2020-03-27}}</ref>
: Although the C++ language requires support for non-ASCII [[Unicode characters]] in [[Identifier (computer languages)|identifiers]], the feature has only been supported since GCC 10. As with the existing handling of string literals, the source file is assumed to be encoded in [[UTF-8]]. The feature is optional in C, but has been made available too since this change.<ref>{{Cite web|url=https://gcc.gnu.org/legacy-ml/gcc-patches/2020-01/msg01667.html|title=Lewis Hyatt - [PATCH] wwwdocs: Document support for extended identifiers added to GCC|website=gcc.gnu.org|access-date=2020-03-27|archive-date=March 27, 2020|archive-url=https://web.archive.org/web/20200327153559/https://gcc.gnu.org/legacy-ml/gcc-patches/2020-01/msg01667.html|url-status=live}}</ref><ref>{{Cite web|url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3146.html|title=Recommendations for extended identifier characters for C and C++|website=www.open-std.org|access-date=2020-03-27|archive-date=September 30, 2020|archive-url=https://web.archive.org/web/20200930152408/http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2010/n3146.html|url-status=live}}</ref>
; C extensions
; C extensions
: GNU C extends the C programming language with several non-standard-features, including [[nested function]]s<ref>{{Cite web|title=C Extensions (Using the GNU Compiler Collection (GCC))|url=https://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html|access-date=2022-01-12|website=gcc.gnu.org}}</ref> and [[typeof|<code>typeof</code>]] expressions.<ref>{{Cite web|title=Typeof - Using the GNU Compiler Collection (GCC)|url=https://gcc.gnu.org/onlinedocs/gcc-5.2.0/gcc/Typeof.html|access-date=2022-01-12|website=gcc.gnu.org}}</ref>
: GNU C extends the C programming language with several non-standard-features, including [[nested function]]s<ref>{{Cite web|title=C Extensions (Using the GNU Compiler Collection (GCC))|url=https://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html|access-date=2022-01-12|website=gcc.gnu.org|archive-date=January 12, 2022|archive-url=https://web.archive.org/web/20220112203037/https://gcc.gnu.org/onlinedocs/gcc/C-Extensions.html|url-status=live}}</ref> and [[typeof|<code>typeof</code>]] expressions.<ref>{{Cite web|title=Typeof - Using the GNU Compiler Collection (GCC)|url=https://gcc.gnu.org/onlinedocs/gcc-5.2.0/gcc/Typeof.html|access-date=2022-01-12|website=gcc.gnu.org|archive-date=January 13, 2022|archive-url=https://web.archive.org/web/20220113093119/https://gcc.gnu.org/onlinedocs/gcc-5.2.0/gcc/Typeof.html|url-status=live}}</ref>


== Architectures ==
== Architectures ==
[[File:GCC DJGPP Windows.png|thumb|249x249px|GCC compiling [["Hello, World!" program|Hello World]] on [[Microsoft Windows|Windows]]]]
[[File:GCC DJGPP Windows.png|thumb|249x249px|GCC compiling [["Hello, World!" program|Hello World]] on [[Microsoft Windows|Windows]]]]

GCC target processor families as of version 11.1 include:<ref>{{Cite web|title=Option Summary (Using the GNU Compiler Collection (GCC))|url=https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gcc/Option-Summary.html#Option-Summary|access-date=2020-08-21|website=gcc.gnu.org}}</ref>
The primary supported (and best tested) processor families are 64- and 32-bit ARM<!-- arch64 and arm-->, 64- and 32-bit [[x86_64]] and [[x86]]<!-- aka e.g. i686 --> and 64-bit [[PowerPC]] and [[SPARC]].<ref>{{Cite web |date=2022-10-26 |title=GCC 12 Release Criteria |url=https://gcc.gnu.org/gcc-12/criteria.html |access-date=2023-01-27 |website=gcc.gnu.org |archive-date=January 27, 2023 |archive-url=https://web.archive.org/web/20230127213916/https://gcc.gnu.org/gcc-12/criteria.html |url-status=live }}</ref> <!-- Notably absent from primary list is e.g. RISC-V and MIPS has been moved to secondary, but the latter has been tested for a long time, and both may actually work well, not sure. Nor sure what to read into OS support, known to work for e.g. Windows (i686-pc-cygwin, i686-mingw32 also 64-bit?):

https://gcc.gnu.org/gcc-12/criteria.html

The primary platforms are:
aarch64-none-linux-gnu
arm-linux-gnueabi
i586-unknown-freebsd
i686-pc-linux-gnu
powerpc64-unknown-linux-gnu
powerpc64le-unknown-linux-gnu
sparc-sun-solaris2.11
x86_64-pc-linux-gnu

The secondary platforms are:
aarch64-elf
i686-apple-darwin
i686-pc-cygwin
i686-mingw32
powerpc-ibm-aix7.1.0.0
s390x-linux-gnu
mips64-linux-gnu
-->

GCC target processor families as of version 11.1 include:<ref>{{Cite web|title=Option Summary (Using the GNU Compiler Collection (GCC))|url=https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gcc/Option-Summary.html#Option-Summary|access-date=2020-08-21|website=gcc.gnu.org|archive-date=January 18, 2023|archive-url=https://web.archive.org/web/20230118185814/https://gcc.gnu.org/onlinedocs/gcc-10.2.0/gcc/Option-Summary.html#Option-Summary|url-status=live}}</ref>


{{div col|colwidth=15em|small=no}}
{{div col|colwidth=15em|small=no}}
Line 211: Line 226:
* [[EISC]]
* [[EISC]]
* [[eSi-RISC]]
* [[eSi-RISC]]
* [[Hexagon (processor)|Hexagon]]<ref>{{Cite web|url=https://www.codeaurora.org/xwiki/bin/Hexagon/|title=Hexagon Project Wiki}}</ref>
* [[Hexagon (processor)|Hexagon]]<ref>{{Cite web |url=https://www.codeaurora.org/xwiki/bin/Hexagon/ |title=Hexagon Project Wiki |url-status=dead |access-date=May 19, 2011 |archive-url=https://web.archive.org/web/20120323192748/https://www.codeaurora.org/xwiki/bin/Hexagon/ |archive-date=March 23, 2012}}</ref>
* [[LatticeMico32]]
* [[LatticeMico32]]
* [[LatticeMico8]]
* [[LatticeMico8]]
Line 217: Line 232:
* [[MicroBlaze]]
* [[MicroBlaze]]
* [[Motorola 6809]]
* [[Motorola 6809]]
* [[MRISC32]]
* [[MSP430]]
* [[MSP430]]
* [[NEC SX architecture]]<ref>{{Cite web|url=https://code.google.com/archive/p/sx-gcc|title=Google Code Archive - Long-term storage for Google Code Project Hosting.|website=code.google.com}}</ref>
* [[NEC SX architecture]]<ref>{{Cite web|url=https://code.google.com/archive/p/sx-gcc|title=Google Code Archive - Long-term storage for Google Code Project Hosting.|website=code.google.com|access-date=September 24, 2021|archive-date=September 25, 2022|archive-url=https://web.archive.org/web/20220925035202/https://code.google.com/archive/p/sx-gcc|url-status=live}}</ref>
* [[Nios II]] and [[Nios embedded processor|Nios]]
* [[Nios II]] and [[Nios embedded processor|Nios]]
* [[OpenRISC]]
* [[OpenRISC]]
Line 235: Line 249:
{{Refend}}
{{Refend}}


The [[GNU Compiler for Java|GCJ]] Java compiler can target either a native machine language architecture or the [[Java virtual machine]]'s [[Java bytecode]].<ref>{{cite web|url=https://gcc.gnu.org/java/|title=The GNU Compiler for the Java Programming Language|access-date=2010-04-22|url-status=dead|archive-url=https://web.archive.org/web/20070509055923/http://gcc.gnu.org/java/|archive-date=May 9, 2007|df=mdy-all}}</ref> When [[retargetable compiler|retargeting]] GCC to a new platform, [[bootstrapping (compilers)|bootstrapping]] is often used. Motorola 68000, Zilog Z80, and other processors are also targeted in the GCC versions developed for various Texas Instruments, Hewlett Packard, Sharp, and Casio programmable graphing calculators.<ref>graphing calculators#programming</ref>
The [[GNU Compiler for Java|GCJ]] Java compiler can target either a native machine language architecture or the [[Java virtual machine]]'s [[Java bytecode]].<ref>{{cite web|url=https://gcc.gnu.org/java/|title=The GNU Compiler for the Java Programming Language|access-date=2010-04-22|url-status=dead|archive-url=https://web.archive.org/web/20070509055923/http://gcc.gnu.org/java/|archive-date=May 9, 2007|df=mdy-all}}</ref> When [[retargetable compiler|retargeting]] GCC to a new platform, [[bootstrapping (compilers)|bootstrapping]] is often used. Motorola 68000, Zilog Z80, and other processors are also targeted in the GCC versions developed for various Texas Instruments, Hewlett Packard, Sharp, and Casio programmable graphing calculators.<ref>graphing calculators#programming</ref>


== License ==
== License ==
GCC is licensed under the [[GNU General Public License]] version 3.<ref>{{Cite web|url=https://gcc.gnu.org/onlinedocs/gcc/Copying.html#Copying|title=Using the GNU Compiler Collection|website=gnu.org|access-date=2019-11-05}}</ref> The ''GCC runtime exception'' permits compilation of proprietary programs (in addition to free software) with GCC. This does not impact the license terms of GCC source code.<ref>{{cite web|publisher=FSF|title=GCC Runtime Exception|url=https://www.gnu.org/licenses/gcc-exception|access-date=2014-04-10}}</ref>
GCC is licensed under the [[GNU General Public License]] version 3.<ref>{{Cite web|url=https://gcc.gnu.org/onlinedocs/gcc/Copying.html#Copying|title=Using the GNU Compiler Collection|website=gnu.org|access-date=2019-11-05|archive-date=November 16, 2023|archive-url=https://web.archive.org/web/20231116021350/https://gcc.gnu.org/onlinedocs/gcc/Copying.html#Copying|url-status=live}}</ref> The ''GCC runtime exception'' permits compilation of proprietary programs (in addition to free software) with GCC. This does not impact the license terms of GCC source code.<ref>{{cite web|publisher=FSF|title=GCC Runtime Exception|url=https://www.gnu.org/licenses/gcc-exception|access-date=2014-04-10|archive-date=April 16, 2014|archive-url=https://web.archive.org/web/20140416192813/https://www.gnu.org/licenses/gcc-exception|url-status=live}}</ref>


== See also ==
== See also ==
Line 253: Line 267:
* ''[https://gcc.gnu.org/onlinedocs/gccint/ GNU Compiler Collection (GCC) Internals]'', Free Software Foundation, 2008.
* ''[https://gcc.gnu.org/onlinedocs/gccint/ GNU Compiler Collection (GCC) Internals]'', Free Software Foundation, 2008.
* ''[https://archive.today/20121205072412/http://www.network-theory.co.uk/gcc/intro/ An Introduction to GCC]'', Network Theory Ltd., 2004 (Revised August 2005). {{ISBN|0-9541617-9-3}}.
* ''[https://archive.today/20121205072412/http://www.network-theory.co.uk/gcc/intro/ An Introduction to GCC]'', Network Theory Ltd., 2004 (Revised August 2005). {{ISBN|0-9541617-9-3}}.
* Arthur Griffith, ''GCC: The Complete Reference''. McGrawHill / Osborne, 2002. {{ISBN|0-07-222405-3}}.
* Arthur Griffith, ''GCC: The Complete Reference''. McGraw Hill / Osborne, 2002. {{ISBN|0-07-222405-3}}.


== External links ==
== External links ==
Line 268: Line 282:
* {{cite news |date=March 2, 2006 |title=New GCC Heavy on Optimization |publisher= internetnews.com |last= Kerner |first=Sean Michael |url = http://www.internetnews.com/dev-news/article.php/3588926 |postscript=none}}
* {{cite news |date=March 2, 2006 |title=New GCC Heavy on Optimization |publisher= internetnews.com |last= Kerner |first=Sean Michael |url = http://www.internetnews.com/dev-news/article.php/3588926 |postscript=none}}
* {{cite news |date=April 22, 2005 |title=Open Source GCC 4.0: Older, Faster |publisher=internetnews.com |last=Kerner |first=Sean Michael |url=http://www.internetnews.com/dev-news/article.php/3499881 |postscript=none |access-date=October 21, 2006 |archive-date=September 17, 2006 |archive-url=https://web.archive.org/web/20060917233745/http://www.internetnews.com/dev-news/article.php/3499881 |url-status=dead }}
* {{cite news |date=April 22, 2005 |title=Open Source GCC 4.0: Older, Faster |publisher=internetnews.com |last=Kerner |first=Sean Michael |url=http://www.internetnews.com/dev-news/article.php/3499881 |postscript=none |access-date=October 21, 2006 |archive-date=September 17, 2006 |archive-url=https://web.archive.org/web/20060917233745/http://www.internetnews.com/dev-news/article.php/3499881 |url-status=dead }}
* [https://web.archive.org/web/20090401215553/http://www.redhat.com/magazine/002dec04/features/gcc/ From Source to Binary: The Inner Workings of GCC], by Diego Novillo, ''[[Red Hat#Red Hat Magazine|Red Hat Magazine]]'', December 2004
* [https://web.archive.org/web/20090401215553/http://www.redhat.com/magazine/002dec04/features/gcc/ From Source to Binary: The Inner Workings of GCC], by Diego Novillo, ''[[Red Hat#Opensource.com|Red Hat Magazine]]'', December 2004
* [http://gcc.gnu.org/pub/gcc/summit/2003/GENERIC%20and%20GIMPLE.pdf A 2003 paper on GENERIC and GIMPLE]
* [http://gcc.gnu.org/pub/gcc/summit/2003/GENERIC%20and%20GIMPLE.pdf A 2003 paper on GENERIC and GIMPLE]
* [https://web.archive.org/web/20171022105307/http://www.toad.com/gnu/cygnus/index.html Marketing Cygnus Support], an essay covering GCC development for the 1990s, with 30 monthly reports for in the "Inside Cygnus Engineering" section near the end
* [https://web.archive.org/web/20171022105307/http://www.toad.com/gnu/cygnus/index.html Marketing Cygnus Support], an essay covering GCC development for the 1990s, with 30 monthly reports for in the "Inside Cygnus Engineering" section near the end

Latest revision as of 23:47, 23 May 2024

GNU Compiler Collection
Original author(s)Richard Stallman
Developer(s)GNU Project
Initial releaseMarch 22, 1987; 37 years ago (1987-03-22)[1]
Stable release
14.1[2] Edit this on Wikidata / 7 May 2024
Repository
Written inC, C++[3]
Operating systemCross-platform
PlatformGNU and many others
Size~15 million LOC[4]
Available inEnglish
TypeCompiler
LicenseGPLv3+ with GCC Runtime Library Exception[5]
Websitegcc.gnu.org

The GNU Compiler Collection (GCC) 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 biggest free programs in existence.[4] It has played an important 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.[1] It was extended to compile C++ in December of that year. Front ends were later developed for Objective-C, Objective-C++, Fortran, Ada, D, Go and Rust,[6] among others.[7] The OpenMP and OpenACC specifications are also supported in the C and C++ compilers.[8][9]

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.

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,[10] largely due to licensing reasons.[11][12][13] GCC can also compile code for Windows, Android, iOS, Solaris, HP-UX, AIX and DOS.[14]

History[edit]

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 was not free, and that only the university was free, Stallman decided to work on a different compiler.[15] His initial plan was to rewrite an existing compiler from Lawrence Livermore National Laboratory from Pastel to C with some help from Len Tower and others.[16][17] 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 with only 64 KB, and concluded he would have to write a new compiler from scratch.[16] None of the Pastel compiler code ended up in GCC, though Stallman did use the C front end he had written.[16][18]

GCC was first released March 22, 1987, available by FTP from MIT.[19] 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.[20] 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.[21] 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.[22]

EGCS fork[edit]

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.[23] 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 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.[23][18] 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),[18] many C++ improvements, and many new architectures and operating system variants.[24]

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.[25][18] GCC has since been maintained by a varied group of programmers from around the world under the direction of a steering committee.[26]

GCC 3 (2002) removed a front-end for CHILL due to a lack of maintenance.[27]

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.[28][29]

As of version 4.8, GCC is implemented in C++.[30]

Support for Cilk Plus existed from GCC 5 to GCC 7.[31][32]

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),[33] ARM-based, and Power ISA-based chips.[34] The compiler can target a wide variety of platforms, including video game consoles such as the PlayStation 2,[35] Cell SPE of PlayStation 3,[36] and Dreamcast.[37] It has been ported to more kinds of processors and operating systems than any other compiler.[38][self-published source?][better source needed]

Supported languages[edit]

As of the 13.1 release, GCC includes front ends for C (gcc), C++ (g++), Objective-C and Objective-C++, Fortran (gfortran), Ada (GNAT), Go (gccgo), D (gdc, since 9.1),[39][40] and Modula-2 (gm2, since 13.1)[41][42] programming languages,[43] with the OpenMP and OpenACC parallel language extensions being supported since GCC 5.1.[9][44] Versions prior to GCC 7 also supported Java (gcj), allowing compilation of Java to native machine code.[45]

Regarding language version support for C++ and C, since GCC 11.1 the default target is gnu++17, a superset of C++17, and gnu11, a superset of C11, with strict standard support also available. GCC also provides experimental support for C++20 and C++23.[46]

Third-party front ends exist for many languages, such as Pascal (gpc), Modula-3, and VHDL (GHDL).[43] A few experimental branches exist to support additional languages, such as the GCC UPC compiler for Unified Parallel C[47] or Rust.[48][49][50][better source needed]

Design[edit]

Overview of GCC's extended compilation pipeline, including specialized programs like the preprocessor, assembler and linker.
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's external interface follows Unix conventions. Users invoke a language-specific driver program (gcc for C, g++ for C++, etc.), which interprets command arguments, calls the actual compiler, runs the assembler on the output, and then optionally runs the linker to produce a complete executable binary.

Each of the language compilers is a separate program that reads source code and outputs machine code. All have a common internal structure. A per-language front end parses the source code in that language and produces an abstract syntax tree ("tree" for short).

These are, if necessary, converted to the middle end's input representation, called GENERIC form; the middle end then gradually transforms the program towards its final form. Compiler optimizations and static code analysis techniques (such as FORTIFY_SOURCE,[51] a compiler directive that attempts to discover some buffer overflows) are applied to the code. These work on multiple representations, mostly the architecture-independent GIMPLE representation and the architecture-dependent RTL representation. Finally, machine code is produced using architecture-specific pattern matching originally based on an algorithm of Jack Davidson and Chris Fraser.

GCC was written primarily in C except for parts of the Ada front end. The distribution includes the standard libraries for Ada and C++ whose code is mostly written in those languages.[52][needs update] On some platforms, the distribution also includes a low-level runtime library, libgcc, written in a combination of machine-independent C and processor-specific machine code, designed primarily to handle arithmetic operations that the target processor cannot perform directly.[53]

GCC uses many additional tools in its build, many of which are installed by default by many Unix and Linux distributions (but which, normally, aren't present in Windows installations), including Perl,[further explanation needed] Flex, Bison, and other common tools. In addition, it currently requires three additional libraries to be present in order to build: GMP, MPC, and MPFR.[54]

In May 2010, the GCC steering committee decided to allow use of a C++ compiler to compile GCC.[55] The compiler was intended to be written mostly in C plus a subset of features from C++. In particular, this was decided so that GCC's developers could use the destructors and generics features of C++.[56]

In August 2012, the GCC steering committee announced that GCC now uses C++ as its implementation language.[57] This means that to build GCC from sources, a C++ compiler is required that understands ISO/IEC C++03 standard.

On May 18, 2020, GCC moved away from ISO/IEC C++03 standard to ISO/IEC C++11 standard (i.e. needed to compile, bootstrap, the compiler itself; by default it however compiles later versions of C++).[58]

Front ends[edit]

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.

Each front end uses a parser to produce the abstract syntax tree of a given source file. Due to the syntax tree abstraction, source files of any of the different supported languages can be processed by the same back end. GCC started out using LALR parsers generated with Bison, but gradually switched to hand-written recursive-descent parsers for C++ in 2004,[59] and for C and Objective-C in 2006.[60] As of 2021 all front ends use hand-written recursive-descent parsers.

Until GCC 4.0 the tree representation of the program was not fully independent of the processor being targeted. The meaning of a tree was somewhat different for different language front ends, and front ends could provide their own tree codes. This was simplified with the introduction of GENERIC and GIMPLE, two new forms of language-independent trees that were introduced with the advent of GCC 4.0. GENERIC is more complex, based on the GCC 3.x Java front end's intermediate representation. GIMPLE is a simplified GENERIC, in which various constructs are lowered to multiple GIMPLE instructions. The C, C++, and Java front ends produce GENERIC directly in the front end. Other front ends instead have different intermediate representations after parsing and convert these to GENERIC.

In either case, the so-called "gimplifier" then converts this more complex form into the simpler SSA-based GIMPLE form that is the common language for a large number of powerful language- and architecture-independent global (function scope) optimizations.

GENERIC and GIMPLE[edit]

GENERIC is an intermediate representation language used as a "middle end" while compiling source code into executable binaries. A subset, called GIMPLE, is targeted by all the front ends of GCC.

The middle stage of GCC does all of the code analysis and optimization, working independently of both the compiled language and the target architecture, starting from the GENERIC[61] representation and expanding it to register transfer language (RTL). The GENERIC representation contains only the subset of the imperative programming constructs optimized by the middle end.

In transforming the source code to GIMPLE,[62] complex expressions are split into a three-address code using temporary variables. This representation was inspired by the SIMPLE representation proposed in the McCAT compiler[63] by Laurie J. Hendren[64] for simplifying the analysis and optimization of imperative programs.

Optimization[edit]

Optimization can occur during any phase of compilation; however, the bulk of optimizations are performed after the syntax and semantic analysis of the front end and before the code generation of the back end; thus a common, though somewhat self-contradictory, name for this part of the compiler is the "middle end."

The exact set of GCC optimizations varies from release to release as it develops, but includes the standard algorithms, such as loop optimization, jump threading, common subexpression elimination, instruction scheduling, and so forth. The RTL optimizations are of less importance with the addition of global SSA-based optimizations on GIMPLE trees,[65] as RTL optimizations have a much more limited scope, and have less high-level information.

Some of these optimizations performed at this level include dead-code elimination, partial-redundancy elimination, global value numbering, sparse conditional constant propagation, and scalar replacement of aggregates. Array dependence based optimizations such as automatic vectorization and automatic parallelization are also performed. Profile-guided optimization is also possible.[66]

C++ Standard Library (libstdc++)[edit]

The GCC project includes an implementation of the C++ Standard Library called libstdc++,[67] licensed under the GPLv3 License with an exception to link non-GPL applications when sources are built with GCC.[68]

Other features[edit]

Some features of GCC include:

Link-time optimization
Link-time optimization optimizes across object file boundaries to directly improve the linked binary. Link-time optimization relies on an intermediate file containing the serialization of some Gimple representation included in the object file.[citation needed] The file is generated alongside the object file during source compilation. Each source compilation generates a separate object file and link-time helper file. When the object files are linked, the compiler is executed again and uses the helper files to optimize code across the separately compiled object files.
Plugins
Plugins extend the GCC compiler directly.[69] Plugins allow a stock compiler to be tailored to specific needs by external code loaded as plugins. For example, plugins can add, replace, or even remove middle-end passes operating on Gimple representations.[70] Several GCC plugins have already been published, notably:
  • The Python plugin, which links against libpython, and allows one to invoke arbitrary Python scripts from inside the compiler. The aim is to allow GCC plugins to be written in Python.
  • The MELT plugin provides a high-level Lisp-like language to extend GCC.[71]
The support of plugins was once a contentious issue in 2007.[72]
C++ transactional memory
The C++ language has an active proposal for transactional memory. It can be enabled in GCC 6 and newer when compiling with -fgnu-tm.[8][73]
Unicode identifiers
Although the C++ language requires support for non-ASCII Unicode characters in identifiers, the feature has only been supported since GCC 10. As with the existing handling of string literals, the source file is assumed to be encoded in UTF-8. The feature is optional in C, but has been made available too since this change.[74][75]
C extensions
GNU C extends the C programming language with several non-standard-features, including nested functions[76] and typeof expressions.[77]

Architectures[edit]

GCC compiling Hello World on Windows

The primary supported (and best tested) processor families are 64- and 32-bit ARM, 64- and 32-bit x86_64 and x86 and 64-bit PowerPC and SPARC.[78]

GCC target processor families as of version 11.1 include:[79]

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

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

The GCJ Java compiler can target either a native machine language architecture or the Java virtual machine's Java bytecode.[82] When retargeting GCC to a new platform, bootstrapping is often used. Motorola 68000, Zilog Z80, and other processors are also targeted in the GCC versions developed for various Texas Instruments, Hewlett Packard, Sharp, and Casio programmable graphing calculators.[83]

License[edit]

GCC is licensed under the GNU General Public License version 3.[84] The GCC runtime exception permits compilation of proprietary programs (in addition to free software) with GCC. This does not impact the license terms of GCC source code.[85]

See also[edit]

References[edit]

  1. ^ a b "GCC Releases". GNU Project. Archived from the original on June 4, 2023. Retrieved July 24, 2020.
  2. ^ Richard Biener (May 7, 2024). "GCC 14.1 Released". Retrieved May 7, 2024.
  3. ^ "GCC Coding Conventions - GNU Project". gcc.gnu.org. Archived from the original on May 28, 2023. Retrieved February 7, 2022.
  4. ^ a b Víctor Rodríguez (October 1, 2019). "Cutting Edge Toolchain (Latest Features in GCC/GLIBC)". youtube.com. Linux Foundation. Archived from the original on November 7, 2021. Retrieved January 19, 2021.
  5. ^ "GCC Runtime Library Exception". Archived from the original on March 31, 2023. Retrieved July 24, 2020.
  6. ^ GCC Rust, Rust GCC, June 4, 2023, archived from the original on January 6, 2023, retrieved June 4, 2023
  7. ^ "Programming Languages Supported by GCC". GNU Project. Archived from the original on January 18, 2023. Retrieved June 23, 2014.
  8. ^ a b "GCC 6 Release Series — Changes, New Features, and Fixes - GNU Project". gcc.gnu.org. Archived from the original on September 22, 2016. Retrieved September 19, 2016.
  9. ^ a b "OpenACC - GCC Wiki". gcc.gnu.org. Archived from the original on April 1, 2015. Retrieved September 19, 2016.
  10. ^ "The LLVM Compiler Infrastructure Project". llvm.org. Archived from the original on January 18, 2023. Retrieved September 24, 2021.
  11. ^ "Apple's GPLv3 purge". meta.ath0.com. February 5, 2012. Archived from the original on January 18, 2023. Retrieved January 12, 2021.
  12. ^ Linnemann, Reid (June 20, 2012). "Why Clang". Archived from the original on January 18, 2023. Retrieved January 12, 2021.
  13. ^ "August 29, 2007: FreeBSD Foundation Newsletter, August 29, 2007". October 11, 2007. Archived from the original on October 11, 2007. Retrieved January 12, 2021.
  14. ^ "Installing GCC: Binaries - GNU Project - Free Software Foundation (FSF)". gcc.gnu.org. Archived from the original on January 5, 2021. Retrieved January 12, 2021.
  15. ^ von Hagen, William (2006). The Definitive Guide to GCC. Definitive Guides (2nd ed.). Apress. p. XXVII. ISBN 978-1-4302-0219-6. Archived from the original on April 5, 2024. Retrieved September 25, 2020. So he wrote to VUCK's author asking if GNU could use it. Evidently, VUCK's developer was uncooperative, responding that the university was free but that the compiler was not.
  16. ^ a b c Stallman, Richard (September 20, 2011). "About the GNU Project". The GNU Project. Archived from the original on August 9, 2019. Retrieved October 9, 2011.
  17. ^ Puzo, Jerome E., ed. (February 1986). "Gnu's Zoo". GNU's Bulletin. 1 (1). Free Software Foundation. Archived from the original on June 23, 2015. Retrieved August 11, 2007.
  18. ^ a b c d von Hagen, William (2006). The Definitive Guide to GCC. Definitive Guides (2nd ed.). Apress. p. XXVII. ISBN 978-1-4302-0219-6. Archived from the original on April 5, 2024. Retrieved September 25, 2020.
  19. ^ Richard M. Stallman (forwarded by Leonard H. Tower Jr.) (March 22, 1987). "GNU C compiler beta test release". Newsgroupcomp.lang.c. Archived from the original on June 2, 2013. Retrieved October 9, 2011.
  20. ^ Stallman, Richard M. (June 22, 2001) [First published 1988], "Contributors to GNU CC", Using and Porting the GNU Compiler Collection (GCC), Free Software Foundation, Inc., p. 7, archived from the original on January 18, 2023, retrieved June 18, 2015.
  21. ^ Salus, Peter H. (2005). "Chapter 10. SUN and gcc". The Daemon, the Gnu and the Penguin. Groklaw. Archived from the original on June 20, 2022. Retrieved September 14, 2015.
  22. ^ Garfinkel, Simson L. (August 6, 1990). "Get ready for GNU software". Computerworld. p. 102.
  23. ^ a b Henkel-Wallace, David (August 15, 1997), A new compiler project to merge the existing GCC forks, archived from the original on January 18, 2023, retrieved May 25, 2012.
  24. ^ "The Short History of GCC development". www.softpanorama.org. Archived from the original on November 9, 2022. Retrieved January 24, 2021.
  25. ^ "History - GCC Wiki". gcc.gnu.org. Archived from the original on January 18, 2023. Retrieved September 28, 2020.
  26. ^ "GCC steering committee - GNU Project". gcc.gnu.org. Archived from the original on January 18, 2023. Retrieved July 25, 2016.
  27. ^ "PATCH] Remove chill". gcc.gnu.org. Archived from the original on October 20, 2016. Retrieved July 29, 2010.
  28. ^ "Chart of Fortran 2003 Features supported by GNU Fortran". GNU. Archived from the original on January 18, 2023. Retrieved June 25, 2009.
  29. ^ "Chart of Fortran 2008 Features supported by GNU Fortran". GNU. Archived from the original on January 18, 2023. Retrieved June 25, 2009.
  30. ^ "GCC 4.8 Release Series — Changes, New Features, and Fixes - GNU Project". gcc.gnu.org. Archived from the original on December 8, 2015. Retrieved February 17, 2015.
  31. ^ "GCC 5 Release Series — Changes, New Features, and Fixes". gcc.gnu.org. Archived from the original on January 18, 2023. Retrieved January 13, 2022.
  32. ^ "GCC 8 Release Series — Changes, New Features, and Fixes". gcc.gnu.org. Archived from the original on November 29, 2018. Retrieved January 13, 2022.
  33. ^ "Symbian GCC Improvement Project". Archived from the original on August 1, 2014. Retrieved November 8, 2007.
  34. ^ "Linux Board Support Packages". Archived from the original on June 7, 2011. Retrieved January 24, 2021.
  35. ^ "setting up gcc as a cross-compiler". ps2stuff. June 8, 2002. Archived from the original on December 11, 2008. Retrieved December 12, 2008.
  36. ^ "CompileFarm - GCC Wiki". gcc.gnu.org. Archived from the original on January 18, 2023. Retrieved September 19, 2016.
  37. ^ "sh4 g++ guide". Archived from the original on December 20, 2002. Retrieved December 12, 2008.
  38. ^ "Linux Information Project". LINFO. Archived from the original on January 3, 2023. Retrieved April 27, 2010. The GCC has been ported to (i.e., modified to run on) more than 60 platforms, which is more than for any other compiler.
  39. ^ "GCC 9 Release Series — Changes, New Features, and Fixes - GNU Project". Archived from the original on February 19, 2022. Retrieved May 7, 2019.
  40. ^ "The D Language Front-End Finally Merged Into GCC 9 - Phoronix". phoronix.com. Archived from the original on May 17, 2022. Retrieved January 19, 2021.
  41. ^ "GCC 13 Release Series — Changes, New Features, and Fixes - GNU Project". Archived from the original on May 26, 2023. Retrieved June 23, 2023.
  42. ^ Proven, Liam (December 16, 2022). "GCC 13 to support Modula-2: Follow-up to Pascal lives on in FOSS form". Archived from the original on December 19, 2022. Retrieved December 19, 2022.
  43. ^ a b "GCC Front Ends". gnu.org. Archived from the original on January 18, 2023. Retrieved November 25, 2011.
  44. ^ "GCC 5 Release Series — Changes, New Features, and Fixes - GNU Project". gcc.gnu.org. Archived from the original on January 18, 2023. Retrieved April 23, 2015.
  45. ^ "GCC 7 Release Series". gnu.org. Archived from the original on September 2, 2020. Retrieved March 20, 2018.
  46. ^ "C++ Standards Support in GCC". Archived from the original on April 20, 2022. Retrieved May 17, 2021.
  47. ^ "GCC UPC (GCC Unified Parallel C)". Intrepid Technology, Inc. February 20, 2006. Archived from the original on February 11, 2010. Retrieved March 11, 2009.
  48. ^ "GCC Front-End For Rust". Archived from the original on January 10, 2023. Retrieved January 6, 2023.
  49. ^ "GCC Front-End for Rust (Github)". GitHub. January 5, 2023. Archived from the original on January 6, 2023. Retrieved January 6, 2023.
  50. ^ Spengler, Brad (January 12, 2021). "Open Source Security, Inc. Announces Funding of GCC Front-End for Rust". Archived from the original on April 25, 2021.
  51. ^ "Security Features: Compile Time Buffer Checks (FORTIFY_SOURCE)". fedoraproject.org. Archived from the original on January 7, 2007. Retrieved March 11, 2009.
  52. ^ "languages used to make GCC". Archived from the original on May 27, 2008. Retrieved September 14, 2008.
  53. ^ "GCC Internals". GCC.org. Archived from the original on January 18, 2023. Retrieved March 1, 2010.
  54. ^ "Prerequisites for GCC - GNU Project". gcc.gnu.org. Archived from the original on January 18, 2023. Retrieved September 5, 2021.
  55. ^ "GCC allows C++ – to some degree". The H. June 1, 2010. Archived from the original on September 26, 2022. Retrieved June 9, 2010.
  56. ^ "Re: Efforts to attract more users?". lists.gnu.org. Archived from the original on January 18, 2023. Retrieved September 24, 2021.
  57. ^ "GCC 4.8 Release Series: Changes, New Features, and Fixes". Archived from the original on December 8, 2015. Retrieved October 4, 2013.
  58. ^ "bootstrap: Update requirement to C++11". GitHub. Archived from the original on September 29, 2022. Retrieved May 18, 2020.
  59. ^ "GCC 3.4 Release Series — Changes, New Features, and Fixes - GNU Project". gcc.gnu.org. Archived from the original on January 18, 2023. Retrieved July 25, 2016.
  60. ^ "GCC 4.1 Release Series — Changes, New Features, and Fixes - GNU Project". gcc.gnu.org. Archived from the original on January 18, 2023. Retrieved July 25, 2016.
  61. ^ "GENERIC (GNU Compiler Collection (GCC) Internals)". gcc.gnu.org. Archived from the original on January 18, 2023. Retrieved July 25, 2016.
  62. ^ "GIMPLE (GNU Compiler Collection (GCC) Internals)". gcc.gnu.org. Archived from the original on January 18, 2023. Retrieved July 25, 2016.
  63. ^ "McCAT". Archived from the original on August 12, 2004. Retrieved September 14, 2017.{{cite web}}: CS1 maint: bot: original URL status unknown (link)
  64. ^ "Laurie Hendren's Home Page". www.sable.mcgill.ca. Archived from the original on September 27, 2022. Retrieved July 20, 2009.
  65. ^ Novillo, Diego (December 2004). "From Source to Binary: The Inner Workings of GCC". Red Hat Magazine. Archived from the original on April 1, 2009.
  66. ^ "Installing GCC: Building - GNU Project". gcc.gnu.org. Archived from the original on August 22, 2023. Retrieved July 25, 2016.
  67. ^ "The GNU C++ Library". GNU Project. Archived from the original on December 25, 2022. Retrieved February 21, 2021.
  68. ^ "License". GNU Project. Archived from the original on January 18, 2023. Retrieved February 21, 2021.
  69. ^ "Plugins". GCC online documentation. Archived from the original on April 30, 2013. Retrieved July 8, 2013.
  70. ^ Starynkevitch, Basile. "GCC plugins thru the MELT example" (PDF). Archived (PDF) from the original on April 13, 2014. Retrieved April 10, 2014.
  71. ^ "About GCC MELT". Archived from the original on July 4, 2013. Retrieved July 8, 2013.
  72. ^ "GCC unplugged [LWN.net]". lwn.net. Archived from the original on November 9, 2020. Retrieved March 28, 2021.
  73. ^ "TransactionalMemory - GCC Wiki". gcc.gnu.org. Archived from the original on August 19, 2016. Retrieved September 19, 2016.
  74. ^ "Lewis Hyatt - [PATCH] wwwdocs: Document support for extended identifiers added to GCC". gcc.gnu.org. Archived from the original on March 27, 2020. Retrieved March 27, 2020.
  75. ^ "Recommendations for extended identifier characters for C and C++". www.open-std.org. Archived from the original on September 30, 2020. Retrieved March 27, 2020.
  76. ^ "C Extensions (Using the GNU Compiler Collection (GCC))". gcc.gnu.org. Archived from the original on January 12, 2022. Retrieved January 12, 2022.
  77. ^ "Typeof - Using the GNU Compiler Collection (GCC)". gcc.gnu.org. Archived from the original on January 13, 2022. Retrieved January 12, 2022.
  78. ^ "GCC 12 Release Criteria". gcc.gnu.org. October 26, 2022. Archived from the original on January 27, 2023. Retrieved January 27, 2023.
  79. ^ "Option Summary (Using the GNU Compiler Collection (GCC))". gcc.gnu.org. Archived from the original on January 18, 2023. Retrieved August 21, 2020.
  80. ^ "Hexagon Project Wiki". Archived from the original on March 23, 2012. Retrieved May 19, 2011.
  81. ^ "Google Code Archive - Long-term storage for Google Code Project Hosting". code.google.com. Archived from the original on September 25, 2022. Retrieved September 24, 2021.
  82. ^ "The GNU Compiler for the Java Programming Language". Archived from the original on May 9, 2007. Retrieved April 22, 2010.
  83. ^ graphing calculators#programming
  84. ^ "Using the GNU Compiler Collection". gnu.org. Archived from the original on November 16, 2023. Retrieved November 5, 2019.
  85. ^ "GCC Runtime Exception". FSF. Archived from the original on April 16, 2014. Retrieved April 10, 2014.

Further reading[edit]

External links[edit]

Official[edit]

Other[edit]