Detecting Compiler Warning Defects Via Diversity-Guided Program Mutation

2021 
Compiler diagnostic warnings help developers identify potential programming mistakes during program compilation. However, these warnings could be erroneous due to the defects of compiler warning diagnostics. Although many techniques have been proposed to automatically generate test programs for compiler warning defect detection, the effectiveness of these techniques on defect-nding is still limited, due to their ability at generating warning-sensitive test program structures. Therefore, in this paper, we propose a DIversity-guided PROgram Mutation approach, called DIPROM, to construct diverse warning-sensitive programs for effective compiler warning defect detection. Given a seed test program, DIPROM rst removes its dead code to reduce false positive warning defects. Then, the abstract syntax tree (AST) of the test program is constructed; DIPROM iteratively mutates the structures of the AST to generate warning-sensitive program variants. To improve the diversity of program variants, DIPROM applies a novel diversity function to guide the selection of the best program variants in each iteration. With the selected program variants, differential testing is conducted to effectively detect warning defects in different compilers. In the experiments, we evaluate DIPROM with two popular C compilers (i.e., GCC and Clang). Experimental results show that DIPROM can detect 75.36% and 218.42% more warning defects than two state-of-the-art approaches (i.e., Epiphron and Csmith), respectively. Meanwhile, DIPROM is efcient, which only spends 61.14% of the time of comparative approaches on average in nding the same number of warning defects. We at last applied DIPROM on the latest development versions of GCC and Clang. After two months running, DIPROM reported 12 new warning defects; nine of them have been conrmed/xed by developers.
    • Correction
    • Source
    • Cite
    • Save
    • Machine Reading By IdeaReader
    0
    References
    0
    Citations
    NaN
    KQI
    []