TY - GEN
T1 - Lenient Execution of C on a Java Virtual Machine: or: How I Learned to Stop Worrying and Run the Code
AU - Rigger, Manuel
AU - Schatz, Roland
AU - Grimmer, Matthias
AU - Mössenböck, Hanspeter
PY - 2017/9/27
Y1 - 2017/9/27
N2 - 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.
AB - 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.
UR - https://www.scopus.com/pages/publications/85049680296
U2 - 10.1145/3132190.3132204
DO - 10.1145/3132190.3132204
M3 - Conference proceedings
SN - 978-1-4503-5340-3
T3 - ACM International Conference Proceeding Series
SP - 35
EP - 47
BT - Proceeding ManLang 2017 Proceedings of the 14th International Conference on Managed Languages and Runtimes
PB - ACM
CY - New York
ER -