arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2009.09117cs.PLcs.SE
收藏

看不见的,不合适的:检测和评估交换参数

Out of Sight, Out of Place: Detecting and Assessing Swapped Arguments

Roger Scott, Joseph Ranieri, Lucja Kot, Vineeth Kashyap

摘要:

程序员经常在命名程序实体(如变量、函数和宏)时添加有关程序语义的有意义的信息。然而,静态分析工具在寻找程序中的错误时,通常会忽略这些信息。在这项工作中,我们描述了一个静态分析检查器SwapD的设计和实现,它使用程序中的自然语言信息来警告错误交换参数在调用站点。SwapD结合了两个独立的检测策略,以提高整体检查器的有效性。我们提出了一个全面的评估结果SwapD在一个大型语料库的C和C++程序总计4.17亿行代码。在这次评估中,SwapD发现了154个手动检查的错误交换参数的真实案例,这表明此类错误虽然在发布的代码中并不普遍,但却是一个真正的问题,值得进行静态分析。

英文摘要:

Programmers often add meaningful information about program semantics when naming program entities such as variables, functions, and macros. However, static analysis tools typically discount this information when they look for bugs in a program. In this work, we describe the design and implementation of a static analysis checker called SwapD, which uses the natural language information in programs to warn about mistakenly-swapped arguments at call sites. SwapD combines two independent detection strategies to improve the effectiveness of the overall checker. We present the results of a comprehensive evaluation of SwapD over a large corpus of C and C++ programs totaling 417 million lines of code. In this evaluation, SwapD found 154 manually-vetted real-world cases of mistakenly-swapped arguments, suggesting that such errors, while not pervasive in released code, are a real problem and a worthwhile target for static analysis.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑