paperbot · PL 论文追踪

全部论文 待读 收藏

P2 Detecting Inconsistencies in If-Condition-Raise Statements

检测 if-条件-raise 语句中的不一致性
ASE Proceedings of the 37th IEEE/ACM International Conference on Automated Software Engineering2022匹配度 4/10 · 论文用深度学习检测 if 条件与抛出异常不一致的 Python 缺陷,属于 ML 辅助程序分析/软件缺陷检测,与 PL+AI 有弱关联;但未涉及用户核心的 LLM/Agent、静态分析/形式化验证、浮点程序分析或贝叶斯程序分析,方法也非基于当前强模型。引用 0 inbox
Islem Bouzenia
crossref: 2026-09-12

AI 速览

一句话:提出深度学习方法 IICR-Finder,检测 if 条件与抛出异常不一致的语句,在 Python 中发现 30 个新缺陷。

开发者常用条件守卫的异常在意外状态时终止程序,但条件与抛出的异常可能暗示不同的停止原因,形成不一致的 if-条件-raise 语句。不一致可能源于条件或异常消息的错误。本文提出 IICR-Finder,一种基于深度学习的方法,同时推理条件的逻辑与异常消息的自然语言,并在不一致时发出警告。为训练二元分类和三重损失两个神经模型,作者提出六种自动生成大量不一致语句的技术。该方法应用于从 4200 万行 Python 代码中提取的 21 万个 if-条件-raise 语句,在历史缺陷修复数据集上以 60% 召回率取得 72% 精确率。在开源项目上运行发现 30 个此前未知的缺陷,报告 10 个,其中 8 个被开发者确认。

问题
开发者用条件守卫的异常来终止程序,但条件与异常消息可能暗示不同的停止原因,导致不一致的 if-条件-raise 语句,现有工作难以自动检测。
方法
提出 IICR-Finder,基于深度学习同时推理条件逻辑与异常消息自然语言,并用六种自动生成不一致语句的技术训练二元分类和三重损失模型。
评估
在 4200 万行 Python 代码的 21 万条语句上评估,历史缺陷修复数据集上精确率 72%、召回率 60%,并在开源项目中发现 30 个新缺陷,8 个被确认。
原文摘要(Abstract)

Developers use exceptions guarded by conditions to abort the execution when a program reaches an unexpected state. However, sometimes the condition and the raised exception do not imply the same stopping reason, in which case, we call them inconsistent if-condition-raise statements. The inconsistency can originate from a mistake in the condition or the exception message. This paper presents IICR-Finder, a deep learning-based approach to detect inconsistent if-condition-raise statements. The approach reasons both about the condition’s logic and the natural language of the exception message and raises a warning in case of inconsistency. We present six techniques to automatically generate large numbers of inconsistent statements to train two neural models based on binary classification and triplet loss. We apply the approach to 210K if-condition-raise statements extracted from 42 million lines of Python code. It achieves a precision of 72% at a recall of 60% on a dataset of past bug fixes. Running IICR-Finder on open-source projects reveals 30 previously unknown bugs, ten of which we reported, with eight confirmed by the developers.

链接与引用

DOI 原文 · PDF(开放获取) ·

BibTeX
@inproceedings{paperbot7206,
  title = {Detecting Inconsistencies in If-Condition-Raise Statements},
  author = {Islem Bouzenia},
  booktitle = {ASE},
  year = {2022},
  doi = {10.1145/3551349.3559514}
}