RUS  ENG
Full version
JOURNALS // Proceedings of the Institute for System Programming of the RAS // Archive

Proceedings of ISP RAS, 2024 Volume 36, Issue 4, Pages 27–40 (Mi tisp906)

Developing a clang-based safe compiler

P. D. Dunaeva, A. A. Sinkevichab, A. M. Granatac, I. A. Batraevab, S. V. Mironovb, N. Yu. Shugaleyad

a Institute for System Programming, Russian Academy of Sciences
b Saratov State University
c Higher School of Economics
d Moscow Institute of Physics and Technology (National Research University)

Abstract: Due to the use of aggressive optimizations by modern C/C++ compilers that exploit undefined behavior, there is a need for a safe compiler that does not perform such optimizations and prevents developers from using unsafe statements and expressions. Such a safe compiler based on GCC has been developed in ISP RAS, but some developers prefer Clang instead of GCC, which has mainly the same problems of exploiting undefined behavior. This paper examines the capabilities of Clang to perform safe compilation and describes the implementation of a safe compiler based on it. For the created safe compiler, the applicability in practice is shown and the impact on program performance is evaluated.

Keywords: compiler; vulnerability; undefined behavior; Clang; LLVM; C; C++.

DOI: 10.15514/ISPRAS-2024-36(4)-3



© Steklov Math. Inst. of RAS, 2025