{"title":"The Impact of Undefined Behavior on Compiler Optimization","authors":"Zefan Shen","doi":"10.1145/3501774.3501781","DOIUrl":null,"url":null,"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.","PeriodicalId":255059,"journal":{"name":"Proceedings of the 2021 European Symposium on Software Engineering","volume":"128 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2021-11-19","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the 2021 European Symposium on Software Engineering","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/3501774.3501781","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 0
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.