Abstract

Despite the substantial progress in compiler testing, research endeavors have mainly focused on detecting compiler crashes and subtle miscompilations caused by bugs in the implementation of compiler optimizations. Surprisingly, this growing body of work neglects other compiler components, most notably the front-end. In statically-typed programming languages with rich and expressive type systems and modern features, such as type inference or a mix of object-oriented with functional programming features, the process of static typing in compiler front-ends is complicated by a high-density of bugs. Such bugs can lead to the acceptance of incorrect programs (breaking code portability or the type system's soundness), the rejection of correct (e.g. well-typed) programs, and the reporting of misleading errors and warnings. We conduct, what is to the best of our knowledge, the first empirical study for understanding and characterizing typing-related compiler bugs. To do so, we manually study 320 typing-related bugs (along with their fixes and test cases) that are randomly sampled from four mainstream JVM languages, namely Java, Scala, Kotlin, and Groovy. We evaluate each bug in terms of several aspects, including their symptom, root cause, bug fix's size, and the characteristics of the bug-revealing test cases. Some representative observations indicate that: (1) more than half of the typing-related bugs manifest as unexpected compile-time errors: the buggy compiler wrongly rejects semantically correct programs, (2) the majority of typing-related bugs lie in the implementations of the underlying type systems and in other core components related to operations on types, (3) parametric polymorphism is the most pervasive feature in the corresponding test cases, (4) one third of typing-related bugs are triggered by non-compilable programs. We believe that our study opens up a new research direction by driving future researchers to build appropriate methods and techniques for a more holistic testing of compilers.

Highlights

  • IntroductionWe have witnessed tremendous advances in techniques for improving compiler reliability

  • Over the past decade, we have witnessed tremendous advances in techniques for improving compiler reliability

  • Around three quarters of groovyc bugs (59 out of 80) make the compiler reject valid code, while we found only ten groovyc crashes compared to 18, 25, and 26 crashes found in the Kotlin, Java, and Scala compilers

Read more

Summary

Introduction

We have witnessed tremendous advances in techniques for improving compiler reliability. The initial focus was on C/C++ compilers, researchers have invested much effort on testing other compilers [Dewey et al 2015; Donaldson et al 2017; Lidbury et al 2015], runtime systems [Chen et al 2019, 2016b], and even dynamic programming languages [Holler et al 2012; Park et al 2020; Wang et al 2019] This exciting research work has led to the discovery and fixing of thousands of bugs in industrial-strength compilers, and has assisted compiler developers in preventing crashes and miscompilations (i.e., generation of incorrect machine instructions) from happening. Another example is the most recent program generator for C/C++ programs [Livinskii et al 2020], which adopts a set of program generation policies that are tailored to triggering specific buggy optimizations

Objectives
Methods
Findings
Conclusion
Full Text
Published version (Free)

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call