Random Testing of C Compilers Targeting Arithmetic Optimization

Eriko Nagai, Hironobu Awazu, Nagisa Ishiura, Naoya Takeda · 2012

This paper presents a method of testing valid- ity of arithmetic optimization of C compilers using ran- dom programs. Compilers are tested by programs which contain randomly generated arithmetic expressions. Un- defined behavior (such as zero division and signed over- flow) of the C language is carefully avoided during ran- dom program generation. This is based on precise com- putation of expected values of the expressions which takes implementation-defined behavior (such as the size of int and the semantics of shift right on negative integers) into account. A method for automatic minimization of error programs is also presented which expedites the analysis of detected errors. A random test program based on our method has detected malfunctions in several compilers, which include LLVM GCC 4.2.1 shipped with the latest Mac OS X, GCC 4.4.4 for Ubuntu Linux, GCC 4.3.4 for Cygwin, and GCC 4.4.1 for h8300-elf and m32r-elf.

Read the paper · More papers on PaperTik