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, Hanspeter Mössenböck

Research output: Chapter in Book/Report/Conference proceedingConference proceedingspeer-review

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.
Original languageEnglish
Title of host publicationProceeding ManLang 2017 Proceedings of the 14th International Conference on Managed Languages and Runtimes
Place of PublicationNew York
PublisherACM
Pages35-47
Number of pages18
ISBN (Print)978-1-4503-5340-3
DOIs
Publication statusPublished - Sept 2017

Fields of science

  • 102 Computer Sciences
  • 102009 Computer simulation
  • 102011 Formal languages
  • 102013 Human-computer interaction
  • 102022 Software development
  • 102024 Usability research
  • 102029 Practical computer science

JKU Focus areas

  • Computation in Informatics and Mathematics
  • Engineering and Natural Sciences (in general)

Cite this