Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

Testing GCC in the wild

March 10, 2016
Marek Polacek

    Currently, the GCC testsuite contains more than fifty thousand tests which make up to two million lines of code. Since we, the GCC developers, try hard to avoid regressions in the compiler, almost every change to the compiler or to a related library requires a new test or a set of tests to be added. Hence the internal testsuite keeps growing at a rapid pace. It goes without saying that a new change should not break any existing test.

    Despite all this effort, new bugs still creep in. Because it is best to discover as many bugs as possible before a particular version of the compiler is released, many distribution maintainers try to rebuild all the packages in the distro with a still unreleased compiler. They file bug reports if they find any bugs to the upstream Bugzilla so that the compiler is up to snuff when it is released. This rebuild typically happens once a year in regression fixes-only stage of the development, i.e. a stage when no new features are being introduced and the development revolves around fixing bugs.

    While a new version of GCC is usually released in April, the Fedora project performs a mass rebuild of all the Fedora packages in January or February. Due to limited resources, this mass rebuild is only done on x86_64 architecture.
    Since the point is to test GCC, this is a mass rebuild of so-called first order.

    We are looking for several classes of bugs here. These include:

    • ICEs, internal compiler errors, are when the compiler just crashes or segfaults. These are always bugs even if the compiler crashes on a code that is not valid or contains undefined behavior. This sort of bug is usually rather easy to deal with. The compiler is clever enough to produce a pre-processed source file in /tmp.
    • false positive warnings occur when the compiler warns on a code even though it should not. This may cause a package build to fail in combination with the -Werror command-line option.
    • Another class of bugs is when the compiler fails to compile valid code. It is sometimes unclear whether the code in question is valid or not in a given language and requires significant expertise to assess; it might even involve raising a DR (Defect Report) with the relevant standard committee.
    • wrong-code issues are the most formidable ones. They very often manifest themselves by causing a package's testsuite to fail. However, the failures can be caused by a host of things; too often these are merely undefined behavior in applications that seemingly worked in the past. Some packages misuse the preprocessor in twisted ways, others might be relying on internal details of libstdc++ headers, and so on. All that makes it hard and quite time-consuming to gauge whether the bug is in the compiler or in the package. Fortunately sanitizers such as UBSan can be extremely useful when examining such failures. Another option is to build the package with e.g. -fno-strict-aliasing or -fno-aggressive-loop-optimizations to see if the build still fails. If any of these options helps, it is most likely a bug in the package.

    When compiler bug is found, it is important to reduce the problem to a stand-alone test case. This helps insure that future versions of the compiler will continue to appropriately detect invalid code or unspecified behaviors. It is understood that some problems such as those which involve LTO are nearly impossible to reduce into a stand alone test case. Given that not every package uses standard GNU Makefiles, it is sometimes needed to dabble with the internals of a package.

    The following is a general overview of how we perform a mass rebuild

    First, we rebuild every package in the distro with the new GCC. The number of packages is ever-increasing; while in 2008 there were 5118 packages, in 2011 it was 10404 packages, and this year there were 17741 packages. Naturally, this number of packages requires the rebuild to run in parallel. We start by creating a repository of all the source RPMs and list of their names. Then we create a second repository, this time with the new GCC and corresponding libtool packages. Afterwards we set up mock and chroot configs on every build machine and prepare a script which downloads an SRPM, rebuilds the SRPM in mock, and saves the logs of the rebuild. Now we run this script fed by the list created before (in parallel) on every build box.

    Secondly, we rebuild failed builds with the old GCC to quickly evaluate packages that failed due to non-GCC related reason.

    Thirdly, we need to investigate FTBFS (Fails To Build From Source) that only happen with the new GCC.

    The result of a mass rebuild is so-called "porting to" document, whose purpose is to provide help with porting a project to the new GCC. This year's "porting to" is still somewhat in flux, but interested readers might want to take a look
    at https://gcc.gnu.org/gcc-6/porting_to.html. Furthermore, we post a summary mail on the Fedora devel mailing list which concludes on the particular mass rebuild. For the latest summary, see https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/DH7M2ADHM6XCRFTRRSKZD6MWFUJKHBZK/.

    Ideally, all the bugs that were discovered during the mass rebuild are fixed, either in the compiler or in the packages built by it.  This annual rebuild should insure that the compiler is of a good quality and is prepared to be deployed as a new system compiler.

    Recent Posts

    • Red Hat Enterprise Linux 10.2 and 9.8: Top features for developers

    • What GPU kernels mean for your distributed inference

    • Debugging image mode with Red Hat OpenShift 4.20: A practical guide

    • EvalHub: Because "looks good to me" isn't a benchmark

    • SQL Server HA on RHEL: Meet Pacemaker HA Agent v2 (tech preview)

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Chat Support

    Please log in with your Red Hat account to access chat support.