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个组件中的强制类型转换,这些组件共计有27MLOC,并通过随机均匀抽样创建了一个手动标记的数据集,包含271个强制类型转换。对这271个强制类型转换的信息理论判断达到了81%的精度和90%的召回率。我们还提供了对显着的显式转换进行深入调查的结果,其中两个在最近的Chromium项目版本中已经得到修复。

0
下载
关闭预览

相关内容

《TextCycleGAN 技术报告》
专知会员服务
31+阅读 · 2023年5月4日
【2022新书】Python数据科学导论,309页pdf
专知会员服务
74+阅读 · 2022年8月6日
【2021新书】《用正确的方式学Python》,456页pdf
专知会员服务
76+阅读 · 2021年6月9日
【干货书】面向计算科学和工程的Python导论,167页pdf
专知会员服务
41+阅读 · 2021年4月7日
【2020干货书】Python3基础导论介绍,98页pdf
专知会员服务
99+阅读 · 2020年10月11日
【干货书】流畅Python,766页pdf,中英文版
专知会员服务
223+阅读 · 2020年3月22日
【SIGGRAPH2019】TensorFlow 2.0深度学习计算机图形学应用
专知会员服务
39+阅读 · 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会员
相关VIP内容
《TextCycleGAN 技术报告》
专知会员服务
31+阅读 · 2023年5月4日
【2022新书】Python数据科学导论,309页pdf
专知会员服务
74+阅读 · 2022年8月6日
【2021新书】《用正确的方式学Python》,456页pdf
专知会员服务
76+阅读 · 2021年6月9日
【干货书】面向计算科学和工程的Python导论,167页pdf
专知会员服务
41+阅读 · 2021年4月7日
【2020干货书】Python3基础导论介绍,98页pdf
专知会员服务
99+阅读 · 2020年10月11日
【干货书】流畅Python,766页pdf,中英文版
专知会员服务
223+阅读 · 2020年3月22日
【SIGGRAPH2019】TensorFlow 2.0深度学习计算机图形学应用
专知会员服务
39+阅读 · 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会员