2021Unpublished venueRequires access

The Impact of Undefined Behavior on Compiler Optimization

Zefan Shen

Open publisher page 3 citations

Abstract

With the development of society and the improvement of life quality, people's requirements for software experience are becoming more and more stringent. Performance optimization is becoming more and more important in software design. At present, most compilers support the default optimization options of o 1, o 2 and o 3, such as the GCC compiler. In order to meet the different degrees of optimization needs of users, it provides nearly a hundred optimization options for compiling time, target file length, and execution. At the same time, compiler optimization options will adjust the code execution order, and different optimization options will treat undefined behaviors differently. This work mainly tests the impact of undefined behavior (UB) on compiler optimization at different levels. The results show that UB has both positive and negative effects on the compiler. In addition, this paper reminds programmers to learn to improve their code specifications and correctly handle these undefined behaviors.

About this research paper

What this paper is about

With the development of society and the improvement of life quality, people's requirements for software experience are becoming more and more stringent. Performance optimization is becoming more and more important in software design. At present, most compilers support the default optimization options of o 1, o 2 and o 3, such as the GCC compiler. In order to meet the different degrees of optimization needs of users, it provides nearly a hundred optimization options for compiling time, target file length, and execution. At the same time, compiler optimization options will adjust the code execution order, and different optimization options will treat undefined behaviors differently. This work mainly tests the impact of undefined behavior (UB) on compiler optimization at different levels. The results show that UB has both positive and negative effects on the compiler. In addition, this paper reminds programmers to learn to improve their code specifications and correctly handle these undefined behaviors.

Why it matters

OpenAlex reports 3 citations for this work. Citation counts describe recorded attention and do not establish research quality.

Key contribution

A contribution statement is not available in the OpenAlex record.

Method / approach

Method details are not available in the OpenAlex metadata.

Main findings

Findings are not separately available in the OpenAlex metadata.

Limitations

Limitations are not available in the OpenAlex metadata.

Applications

Application details are not available in the OpenAlex metadata.

Available abstract

With the development of society and the improvement of life quality, people's requirements for software experience are becoming more and more stringent. Performance optimization is becoming more and more important in software design. At present, most compilers support the default optimization options of o 1, o 2 and o 3, such as the GCC compiler. In order to meet the different degrees of optimization needs of users, it provides nearly a hundred optimization options for compiling time, target file length, and execution. At the same time, compiler optimization options will adjust the code execution order, and different optimization options will treat undefined behaviors differently. This work mainly tests the impact of undefined behavior (UB) on compiler optimization at different levels. The results show that UB has both positive and negative effects on the compiler. In addition, this paper reminds programmers to learn to improve their code specifications and correctly handle these undefined behaviors.

Key concepts: Compiler, Computer science, Optimizing compiler, Program optimization, Interprocedural optimization, Loop optimization, Programming language, Code (set theory)

Related papers

Back to paper searchBrowse research topicsOriginal source
The Impact of Undefined Behavior on Compiler Optimization — Research Paper | ScholarLens