The Impact of Undefined Behavior on Compiler Optimization

Zefan Shen
{"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.
未定义行为对编译器优化的影响
随着社会的发展和生活质量的提高,人们对软件体验的要求也越来越严格。性能优化在软件设计中变得越来越重要。目前,大多数编译器都支持默认的0 1、0 2和0 3的优化选项,比如GCC编译器。为了满足用户不同程度的优化需求,提供了编译时间、目标文件长度、执行等近百种优化选项。同时,编译器优化选项会调整代码执行顺序,不同的优化选项对未定义行为的处理方式也不同。本工作主要测试未定义行为(UB)在不同层次上对编译器优化的影响。结果表明,UB对编译器既有积极的影响,也有消极的影响。此外,本文还提醒程序员要学会改进自己的代码规范,正确处理这些未定义的行为。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约1分钟内获得全文 求助全文
来源期刊
自引率
0.00%
发文量
0
×
引用
GB/T 7714-2015
复制
MLA
复制
APA
复制
导出至
BibTeX EndNote RefMan NoteFirst NoteExpress
×
提示
您的信息不完整,为了账户安全,请先补充。
现在去补充
×
提示
您因"违规操作"
具体请查看互助需知
我知道了
×
提示
确定
请完成安全验证×
copy
已复制链接
快去分享给好友吧!
我知道了
右上角分享
点击右上角分享
0
联系我们:info@booksci.cn Book学术提供免费学术资源搜索服务,方便国内外学者检索中英文文献。致力于提供最便捷和优质的服务体验。 Copyright © 2023 布克学术 All rights reserved.
京ICP备2023020795号-1
ghs 京公网安备 11010802042870号
Book学术文献互助
Book学术文献互助群
群 号:481959085
Book学术官方微信