Lenient Execution of C on a Java Virtual Machine: or: How I Learned to Stop Worrying and Run the Code

Manuel Rigger, Roland Schatz, Matthias Grimmer, H. Mössenböck
{"title":"Lenient Execution of C on a Java Virtual Machine: or: How I Learned to Stop Worrying and Run the Code","authors":"Manuel Rigger, Roland Schatz, Matthias Grimmer, H. Mössenböck","doi":"10.1145/3132190.3132204","DOIUrl":null,"url":null,"abstract":"Most C programs do not conform strictly to the C standard, and often show undefined behaviors, for instance, in the case of signed integer overflow. When compiled by non-optimizing compilers, such programs often behave as the programmer intended. However, optimizing compilers may exploit undefined semantics to achieve more aggressive optimizations, possibly breaking the code in the process. Analysis tools can help to find and fix such issues. Alternatively, a C dialect could be defined in which clear semantics are specified for frequently occurring program patterns with otherwise undefined behaviors. In this paper, we present Lenient C, a C dialect that specifies semantics for behaviors left open for interpretation in the standard. Specifying additional semantics enables programmers to make safe use of otherwise undefined patterns. We demonstrate how we implemented the dialect in Safe Sulong, a C interpreter with a dynamic compiler that runs on the JVM.","PeriodicalId":157584,"journal":{"name":"Proceedings of the 14th International Conference on Managed Languages and Runtimes","volume":"98 1","pages":"0"},"PeriodicalIF":0.0000,"publicationDate":"2017-09-27","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"7","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Proceedings of the 14th International Conference on Managed Languages and Runtimes","FirstCategoryId":"1085","ListUrlMain":"https://doi.org/10.1145/3132190.3132204","RegionNum":0,"RegionCategory":null,"ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"","JCRName":"","Score":null,"Total":0}
引用次数: 7

Abstract

Most C programs do not conform strictly to the C standard, and often show undefined behaviors, for instance, in the case of signed integer overflow. When compiled by non-optimizing compilers, such programs often behave as the programmer intended. However, optimizing compilers may exploit undefined semantics to achieve more aggressive optimizations, possibly breaking the code in the process. Analysis tools can help to find and fix such issues. Alternatively, a C dialect could be defined in which clear semantics are specified for frequently occurring program patterns with otherwise undefined behaviors. In this paper, we present Lenient C, a C dialect that specifies semantics for behaviors left open for interpretation in the standard. Specifying additional semantics enables programmers to make safe use of otherwise undefined patterns. We demonstrate how we implemented the dialect in Safe Sulong, a C interpreter with a dynamic compiler that runs on the JVM.
C语言在Java虚拟机上的宽松执行:或:我如何学会停止担心并运行代码
大多数C程序并不严格遵守C标准,并且经常显示未定义的行为,例如,在有符号整数溢出的情况下。当由非优化编译器编译时,这些程序通常按照程序员的意图运行。然而,优化编译器可能会利用未定义的语义来实现更激进的优化,这可能会在过程中破坏代码。分析工具可以帮助找到并修复这些问题。或者,可以定义一种C方言,其中为经常出现的具有未定义行为的程序模式指定清晰的语义。在本文中,我们提出了宽大的C语言,这是一种C语言方言,它指定了在标准中为解释保留开放的行为的语义。指定额外的语义使程序员能够安全地使用其他未定义的模式。我们将演示如何在Safe Sulong中实现该方言,Safe Sulong是一个带有运行在JVM上的动态编译器的C解释器。
本文章由计算机程序翻译,如有差异,请以英文原文为准。
求助全文
约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学术文献互助群
群 号:604180095
Book学术官方微信