# Understanding GCC Builtins to Develop Better Tools

**Authors:** Manuel Rigger, Stefan Marr, Bram Adams, Hanspeter M\"ossenb\"ock

arXiv: 1907.00863 · 2019-07-02

## TL;DR

This paper analyzes GCC builtin usage in thousands of GitHub C projects to guide tool developers on which builtins to support, showing that supporting a small subset covers most projects and highlighting gaps in current tool support.

## Contribution

It provides the first large-scale analysis of builtin usage in real-world C projects, offering guidance for efficient support implementation and revealing support gaps in existing tools.

## Key findings

- 37% of projects rely on at least one builtin
- Supporting 10 builtins covers over 30% of projects
- Many tools lack full or correct builtin support

## Abstract

C programs can use compiler builtins to provide functionality that the C language lacks. On Linux, GCC provides several thousands of builtins that are also supported by other mature compilers, such as Clang and ICC. Maintainers of other tools lack guidance on whether and which builtins should be implemented to support popular projects. To assist tool developers who want to support GCC builtins, we analyzed builtin use in 4,913 C projects from GitHub. We found that 37% of these projects relied on at least one builtin. Supporting an increasing proportion of projects requires support of an exponentially increasing number of builtins; however, implementing only 10 builtins already covers over 30% of the projects. Since we found that many builtins in our corpus remained unused, the effort needed to support 90% of the projects is moderate, requiring about 110 builtins to be implemented. For each project, we analyzed the evolution of builtin use over time and found that the majority of projects mostly added builtins. This suggests that builtins are not a legacy feature and must be supported in future tools. Systematic testing of builtin support in existing tools revealed that many lacked support for builtins either partially or completely; we also discovered incorrect implementations in various tools, including the formally verified CompCert compiler.

## Full text

_Full body text omitted from this summary view._ Fetch the complete paper as Markdown: https://tomesphere.com/paper/1907.00863/full.md

## Figures

11 figures with captions in the complete paper: https://tomesphere.com/paper/1907.00863/full.md

## References

67 references — full list in the complete paper: https://tomesphere.com/paper/1907.00863/full.md

---
Source: https://tomesphere.com/paper/1907.00863