Developers relax restrictions on a type to reuse methods with other types. While type casts are prevalent, in weakly typed languages such as C++, they are also extremely permissive. Assignments where a source expression is cast into a new type and assigned to a target variable of the new type, can lead to software bugs if performed without care. In this paper, we propose an information-theoretic approach to identify poor implementations of explicit cast operations. Our approach measures accord between the source expression and the target variable using conditional entropy. We collect casts from 34 components of the Chromium project, which collectively account for 27MLOC and random-uniformly sample this dataset to create a manually labelled dataset of 271 casts. Information-theoretic vetting of these 271 casts achieves a peak precision of 81% and a recall of 90%. We additionally present the findings of an in-depth investigation of notable explicit casts, two of which were fixed in recent releases of the Chromium project.


翻译:开发者通过放宽类型的限制来复用其他类型的方法。类型转换在弱类型语言(如C++)中普遍存在,且极为宽松。若不加谨慎地将源表达式转换为新类型并赋值给该新类型的目标变量,可能导致软件缺陷。本文提出一种基于信息论的方法来识别显式转换操作中的不良实现。该方法利用条件熵衡量源表达式与目标变量之间的一致性。我们从Chromium项目的34个组件中收集转换操作(总计2700万行代码),并随机均匀采样该数据集,构建了一个包含271个转换的人工标注数据集。对这271个转换进行信息论审查后,达到81%的峰值精确率和90%的召回率。此外,我们深入调查了若干值得关注的显式转换案例,其中两个已在Chromium项目的最新版本中修复。

0
下载
关闭预览

相关内容

《TextCycleGAN 技术报告》
专知会员服务
34+阅读 · 2023年5月4日
【2022新书】Python数据科学导论,309页pdf
专知会员服务
83+阅读 · 2022年8月6日
【2021新书】《用正确的方式学Python》,456页pdf
专知会员服务
81+阅读 · 2021年6月9日
【干货书】面向计算科学和工程的Python导论,167页pdf
专知会员服务
42+阅读 · 2021年4月7日
【2020干货书】Python3基础导论介绍,98页pdf
专知会员服务
104+阅读 · 2020年10月11日
【干货书】流畅Python,766页pdf,中英文版
专知会员服务
229+阅读 · 2020年3月22日
【SIGGRAPH2019】TensorFlow 2.0深度学习计算机图形学应用
专知会员服务
41+阅读 · 2019年10月9日
【推荐】用TensorFlow实现LSTM社交对话股市情感分析
机器学习研究会
11+阅读 · 2018年1月14日
【推荐】自然语言处理(NLP)指南
机器学习研究会
35+阅读 · 2017年11月17日
【推荐】用Tensorflow理解LSTM
机器学习研究会
36+阅读 · 2017年9月11日
【推荐】RNN/LSTM时序预测
机器学习研究会
25+阅读 · 2017年9月8日
【推荐】SVM实例教程
机器学习研究会
17+阅读 · 2017年8月26日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
1+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
1+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
Arxiv
0+阅读 · 2023年5月20日
VIP会员
最新内容
对抗环境下超视距目标打击的情报支援
专知会员服务
3+阅读 · 今天14:49
《无人机对海面作战影响评估》
专知会员服务
11+阅读 · 7月21日
印度精确打击与指挥架构的断层
专知会员服务
6+阅读 · 7月20日
美空军AI完成F-16战斗机自主空战历史性试飞
专知会员服务
6+阅读 · 7月20日
相关VIP内容
《TextCycleGAN 技术报告》
专知会员服务
34+阅读 · 2023年5月4日
【2022新书】Python数据科学导论,309页pdf
专知会员服务
83+阅读 · 2022年8月6日
【2021新书】《用正确的方式学Python》,456页pdf
专知会员服务
81+阅读 · 2021年6月9日
【干货书】面向计算科学和工程的Python导论,167页pdf
专知会员服务
42+阅读 · 2021年4月7日
【2020干货书】Python3基础导论介绍,98页pdf
专知会员服务
104+阅读 · 2020年10月11日
【干货书】流畅Python,766页pdf,中英文版
专知会员服务
229+阅读 · 2020年3月22日
【SIGGRAPH2019】TensorFlow 2.0深度学习计算机图形学应用
专知会员服务
41+阅读 · 2019年10月9日
相关基金
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
0+阅读 · 2013年12月31日
国家自然科学基金
1+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
1+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2012年12月31日
国家自然科学基金
0+阅读 · 2009年12月31日
Top
微信扫码咨询专知VIP会员