Compiler bugs pose a significant threat to safety-critical applications, and promptly as well as effectively isolating these bugs is crucial for assuring the quality of compilers. However, the limited availability of debugging information on reported bugs complicates the compiler bug isolation task. Existing compiler bug isolation approaches convert the problem into a test program mutation problem, but they are still limited by ineffective mutation strategies or high human effort requirements. Drawing inspiration from the recent progress of pre-trained Large Language Models (LLMs), such as ChatGPT, in code generation, we propose a new approach named LLM4CBI to utilize LLMs to generate effective test programs for compiler bug isolation. However, using LLMs directly for test program mutation may not yield the desired results due to the challenges associated with formulating precise prompts and selecting specialized prompts. To overcome the challenges, three new components are designed in LLM4CBI. First, LLM4CBI utilizes a program complexity-guided prompt production component, which leverages data and control flow analysis to identify the most valuable variables and locations in programs for mutation. Second, LLM4CBI employs a memorized prompt selection component, which adopts reinforcement learning to select specialized prompts for mutating test programs continuously. Third, a test program validation component is proposed to select specialized feedback prompts to avoid repeating the same mistakes during the mutation process. Compared with state-of-the-art approaches over 120 real bugs from GCC and LLVM, our evaluation demonstrates the advantages of LLM4CBI: It can isolate 69.70%/21.74% and 24.44%/8.92% more bugs than DiWi and RecBi within Top-1/Top-5 ranked results. We also demonstrate that the LLMs component used in LLM4CBI can be easily replaced while still achieving reasonable results.
翻译:编译器缺陷对关键安全应用构成严重威胁,及时有效地隔离这些缺陷对于确保编译器质量至关重要。然而,已报告缺陷中调试信息的有限可用性使编译器缺陷隔离任务复杂化。现有编译器缺陷隔离方法将问题转化为测试程序变异问题,但受限于无效的变异策略或过高的人力需求。受预训练大语言模型(如ChatGPT)在代码生成领域最新进展的启发,我们提出一种名为LLM4CBI的新方法,利用大语言模型为编译器缺陷隔离生成有效测试程序。然而,由于构造精确提示和选择专业化提示的挑战,直接使用大语言模型进行测试程序变异可能无法达到预期效果。为克服这些挑战,LLM4CBI设计了三个新组件。首先,LLM4CBI采用程序复杂度引导的提示生成组件,通过数据流与控制流分析识别程序中用于变异的最有价值变量和位置。其次,LLM4CBI引入记忆化提示选择组件,采用强化学习持续选择专业化提示进行测试程序变异。第三,提出测试程序验证组件,通过选择专业化反馈提示避免变异过程中重复相同错误。基于GCC和LLVM中120个真实缺陷的评估表明,与当前最先进方法相比,LLM4CBI具有显著优势:在Top-1/Top-5排名结果中,其隔离缺陷数量分别比DiWi和RecBi多69.70%/21.74%和24.44%/8.92%。我们还证明,LLM4CBI中使用的大语言模型组件可便捷替换,同时仍能获得合理结果。