Finding and Analyzing Compiler Warning Defects

Good compiler diagnostic warnings facilitate software development as they indicate likely programming mistakes or code smells. However, due to compiler bugs, the warnings may be erroneous, superfluous or missing, even for mature production compilers like GCC and Clang. In this paper, we (1) propose the first randomized differential testing technique to detect compiler warning defects and (2) describe our extensive evaluation in finding warning defects in widely-used C compilers.At the high level, our technique starts with generating random programs to trigger compilers to emit a variety of compiler warnings, aligns the warnings from different compilers, and identifies inconsistencies as potential bugs. We develop effective techniques to overcome three specific challenges: (1) How to generate random programs, (2) how to align textual warnings, and (3) how to reduce test programs for bug reporting?Our technique is very effective — we have found and reported 60 bugs for GCC (38 confirmed, assigned or fixed) and 39 for Clang (14 confirmed or fixed). This case study not only demonstrates our technique’s effectiveness, but also highlights the need to continue improving compilers’ warning support, an essential, but rather neglected aspect of compilers.

[1]  Zhendong Su,et al.  Finding deep compiler bugs via guided stochastic program mutation , 2015, OOPSLA.

[2]  Luciano Baresi,et al.  An Introduction to Software Testing , 2006, FoVMT.

[3]  Lorenzo Martignoni,et al.  Testing system virtual machines , 2010, ISSTA '10.

[4]  Lorenzo Martignoni,et al.  A methodology for testing CPU emulators , 2013, TSEM.

[5]  Peter J. Brown,et al.  Error messages: the neglected area of the man/machine interface , 1983, CACM.

[6]  Xuejun Yang,et al.  Finding and understanding bugs in C compilers , 2011, PLDI '11.

[7]  Xuejun Yang,et al.  Test-case reduction for C compiler bugs , 2012, PLDI.

[8]  Ben Shneiderman,et al.  Designing computer system messages , 1982, CACM.

[9]  Mitchell Wand Finding the source of type errors , 1986, POPL '86.

[10]  Atsushi Hashimoto,et al.  Scaling up Size and Number of Expressions in Random Testing of Arithmetic Optimization of C Compilers , 2013 .

[11]  Xuejun Yang,et al.  Testing Static Analyzers with Randomly Generated Programs , 2012, NASA Formal Methods.

[12]  Michael A. Howard,et al.  A process for performing security code reviews , 2006, IEEE Security & Privacy.

[13]  A. Jefferson Offutt,et al.  Introduction to Software Testing , 2008 .

[14]  J. David Morgenthaler,et al.  Evaluating static analysis defect warnings on production software , 2007, PASTE '07.

[15]  V. Javier Traver,et al.  On Compiler Error Messages: What They Say and What They Mean , 2010, Adv. Hum. Comput. Interact..

[16]  References , 1971 .

[17]  Thomas R. Flowers,et al.  Empowering students and building confidence in novice programmers through Gauntlet , 2004, 34th Annual Frontiers in Education, 2004. FIE 2004..

[18]  Dan Grossman,et al.  Searching for type-error messages , 2007, PLDI '07.

[19]  Mark Harman,et al.  An Analysis and Survey of the Development of Mutation Testing , 2011, IEEE Transactions on Software Engineering.

[20]  Natalie J. Coull,et al.  SNOOPIE : development of a learning support tool for novice programmers within a conceptual framework , 2008 .

[21]  Zhendong Su,et al.  Randomized stress-testing of link-time optimizers , 2015, ISSTA.

[22]  W. M. McKeeman,et al.  Differential Testing for Software , 1998, Digit. Tech. J..

[23]  Zhendong Su,et al.  Compiler validation via equivalence modulo inputs , 2014, PLDI.

[24]  Andreas Zeller,et al.  Simplifying and Isolating Failure-Inducing Input , 2002, IEEE Trans. Software Eng..

[25]  P. Oman,et al.  Maintainability measurements on industrial source code maintenance activities , 1995, Proceedings of International Conference on Software Maintenance.

[26]  Alex Groce,et al.  Taming compiler fuzzers , 2013, ACM-SIGPLAN Symposium on Programming Language Design and Implementation.

[27]  Scott R. Klemmer,et al.  What would other programmers do: suggesting solutions to error messages , 2010, CHI.

[28]  Liang Guo,et al.  Automated test program generation for an industrial optimizing compiler , 2009, 2009 ICSE Workshop on Automation of Software Test.