Annoying error of Uninitialized Memory Access
来源:互联网 发布:淘宝优品乐购 编辑:程序博客网 时间:2024/06/05 16:16
While analyzing a huge project at the mi4 level of Intel® Parallel Inspector, a user may get a lot of errors referred as 'Uninitialized Memory Access' which might considered as a false positives. In some cases these errors do not reflect the real problem in the application and a bunch of such errors might be annoying. Before getting rid of these errors with the Suppressions mechanism let’s consider the problem. The result of a mi4 level memory analysis of simple program is represented on the picture below. Inspector fires the Uninitialized Memory Access error blaming memcpy() function which reads the uninitialized memory pointed by foo.
Looking at the sample code, we can conclude that the flagged read operation does not affect correctness of the whole application, although it is not good engineering practice.
It should be mentioned that Inspector does not report the error on the mi2 or mi3 levels (and not at mi1). However, a user might want to hide such reports for the sake of not littering the real errors list. There is an easy way to do that with the help of suppressions.
In the Details view of the results, select 'Read' observation for this problem, right-click the mouse for the context menu and choose 'Suppress...'.
In the private suppression dialog create a filter with 'Uninitialized memory access' problem and 'Read' description. For all other columns (module, function, etc.) you may set * (all) depending of scope of interest. The setting will be saved in the .sup file which can be reused with any other project if made public (Tools > Options > Intel Parallel Inspector > General > Suppressions).
This can also be set by selecting 'Private Suppression: Delete problems' in the Configure Analysis dialog box before you click on 'Run Analysis'.
The error will not appear after level mi4 analysis is completed.
Where an instruction is added to code that uses the uninitialized memory in a way that might affect correctness, Inspector should report the error regardless if 'Uninitialized memory access' is suppressed. Consider the following sample code. A printf() instruction sending the content of uninitialized memory to the output is added to the initial sample.
Inspector will report ‘Invalid memory Access’ error on each level mi2-mi4 and flag the source code line containing the prinf() call.
Looking at the sample code, we can conclude that the flagged read operation does not affect correctness of the whole application, although it is not good engineering practice.
1
int
main() {
2
char
*foo = (
char
*)
malloc
(100);
3
char
*bar = (
char
*)
malloc
(100);
4
memcpy
(bar, foo, 100);
5
6
free
(bar);
7
free
(foo);
8
return
0;
9
}
It should be mentioned that Inspector does not report the error on the mi2 or mi3 levels (and not at mi1). However, a user might want to hide such reports for the sake of not littering the real errors list. There is an easy way to do that with the help of suppressions.
In the Details view of the results, select 'Read' observation for this problem, right-click the mouse for the context menu and choose 'Suppress...'.
In the private suppression dialog create a filter with 'Uninitialized memory access' problem and 'Read' description. For all other columns (module, function, etc.) you may set * (all) depending of scope of interest. The setting will be saved in the .sup file which can be reused with any other project if made public (Tools > Options > Intel Parallel Inspector > General > Suppressions).
This can also be set by selecting 'Private Suppression: Delete problems' in the Configure Analysis dialog box before you click on 'Run Analysis'.
The error will not appear after level mi4 analysis is completed.
Where an instruction is added to code that uses the uninitialized memory in a way that might affect correctness, Inspector should report the error regardless if 'Uninitialized memory access' is suppressed. Consider the following sample code. A printf() instruction sending the content of uninitialized memory to the output is added to the initial sample.
1
int
main() {
2
char
*foo = (
char
*)
malloc
(100);
3
char
*bar = (
char
*)
malloc
(100);
4
memcpy
(bar, foo, 100);
5
printf
(
"%cn"
, bar[100]);
//referencing uninitialized mem
6
free
(bar);
7
free
(foo);
8
return
0;
9
}
Inspector will report ‘Invalid memory Access’ error on each level mi2-mi4 and flag the source code line containing the prinf() call.
- Annoying error of Uninitialized Memory Access
- PETSC ERROR: Segmentation Violation, probably memory access out of range
- AudioRecord uninitialized Error
- STL之处理uninitialized memory
- JVM out of memory error
- Out of memory Error (5.0)
- Linux Out of memory error
- Routing Error uninitialized constant TransController
- perl: Use of uninitialized value
- C++ Utilities四(Uninitialized memory的使用)
- Using Uninitialized Memory for Fun and Profit
- tomcat "out of memory" error 的解决办法
- Flex ant out of memory error.
- ORA-27102: Out of memory error
- Out of memory error in Eclipse
- Eclispse Out Of Memory Error Solution
- An out of memory error has occurred.
- Understand memory access characteristics of motion estimation algorithms
- 记录一下关于IntelliJ IDEA 及部分使用问题
- CATransform3D相关的
- 向Mapcontrol中增加栅格图层
- 算法导论 4.4-2
- Netty中的session属性设置和链接事件捕获
- Annoying error of Uninitialized Memory Access
- java Map常用操作
- FSD HOOK与SSDT HOOK恢复简单思路
- Ubuntu 下文件同步与SSH无密码登陆
- Eclipse中syso 快捷键 Alt + / 不能使用的问题
- 深入学习Django源码基础8 - Django中系统级国际化本地化
- 基于键盘过滤驱动的键盘助手
- linux内核编译过程的最终总结版
- 每一个activity都要在AndroidManifest.xml注册和字体