- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I'm using Intel Inspector to check my C++ code which is using Intel IPP. Please, check my question on Insepctor forum: http://software.intel.com/en-us/forums/topic/343032
Link Copied
20 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Mikhail,
>>...
>>P26 - Unuinitialized memory access - imageutils.cpp
Could you provide more technical details? Did your application crash / failed?
Best regards,
Sergey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes. Please provide a test case if you can.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your reply. No, my application don't crash/fail. It works normally and does what it is meant to do. That's why these errors might be false/positives. I'll try to prepare a separate project, which reproduces the error.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I prepared a clean solution, which reproduces one of the errors. Namely, Uninitialized memory access in ippiMorphologyInit_8u_C1R. The solution is compiled against IPP v 7.0.205 using Visual Studio 2010 SP1. I also included a report generated by Intel Inspector XE 2013 (Update 3).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't know what exactly happens inside of ippiMorphologyInit_8u_C1R function and I simply would like to provide two examples that demonstrate why Inspector XE could show some error(s):
[ Example 1 ]
include *stdio.h*
class CTest
{
public:
Test(){};
~Test(){};
int m_iValue; // There is No initialization of the member and Inspector XE could show an error / Will an application crash? In that case No
};
void main( void )
{
CTest objTest;
objTest.m_iValue = 0;
printf( "CTest::m_iValue value: %ld\n", objTest.m_iValue );
}
[ Example 2 ]
include *stdio.h*
class CTest
{
public:
Test()
{
m_iValue = 0;
};
~Test(){};
int m_iValue; // There is initialization of the member and Inspector XE shouln't show an error
};
void main( void )
{
CTest objTest;
printf( "CTest::m_iValue value: %ld\n", objTest.m_iValue );
}
Uninitialized variables or members of a structure or a class don't cause any craches unless they are used in some loops ( 'for', 'while', etc ) or simply used in calculations. It is a matter of overall quality of source codes and a software product. It is not clear for me why it wasn't detected and fixed by IPP software developers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could you at least point IPP team on this issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>...Could you at least point IPP team on this issue?
Please believe me that guys from IPP team are reading all our posts. I hope to see a feedback from Intel software engineers of IPP team as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mikhail Matrosov wrote:Hi, Mikhail, Yes. it looks that there is a problem in ippiMorphologyInit_8u_C1R function. Thank you for notifying this. Though it doesn't affect the functionality (looks like there are unnecessary fields in internal structure which are not initialized and not used), this issue will be fixed. Thank you again! Regards, SergeyCould you at least point IPP team on this issue?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Please note, I have the same errors for the following functions in my original project (I didn't add them to repro-case):
ippiFilterGauss_8u_C1R, ippiFilter_32f_C1R, ippiFilterMin_8u_C1R
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
We'll check them too.
Regards,
Sergey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>...I have the same errors for the following functions in my original project (I didn't add them to repro-case)...
Hi Mikhail,
I think you need to report on Inspector XE forum that when a variable ( global or in a function ) or a member of some struct / class is Not initialized and Not used the Inspector XE should report it as a Warning instead of as an Error.
Best regards,
Sergey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sergey Khlystov (Intel) wrote:Hi Mikhail, We have checked FilterMin, FilterGauss and Filter functions and haven't seen problems there. Please, make sure you allocate correct images, set correct masks and anchors. Or, you can provide us with sample project where problems are seen. Regards, SergeyWe'll check them too.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sergey Khlystov (Intel) wrote:Here is updated solution and Inspector report reproducing errors in FilterMin and FilterGauss.Quote:
Sergey Khlystov (Intel) wrote:We'll check them too.
Hi Mikhail,
We have checked FilterMin, FilterGauss and Filter functions and haven't seen problems there. Please, make sure you allocate correct images, set correct masks and anchors. Or, you can provide us with sample project where problems are seen.
Regards,
Sergey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Mikhail,
You were reight about Gauss/Min functions in IPP 7.x. Somehow, I don't see inspector issues in current library (under development), may be it's because compiler has been changed.
Anyway, there must be no issue, because sometimes for performance purposes it's more efficient to read/write bytes using bigger chunks. Say, 32/64/128-bit words. If you, for example, initialize buf[1] and buf[3] bytes of array, it can be faster to read buf[0-3] bytes into 32-bit register, set bytes 1 and 3 in that register and write the register back, then read byte 1/write byte 1/read byte 3/write byte 3. Of course, the address to read/write must be properly aligned. Technically, we read uninitialized data, but logically we do nothing with it. Inspector can generate false alarm here.
IPP functions are thouroughly tested for correctness and side effects absence.
Regards,
Sergey
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, thank your for explanation and feedback.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>...Inspector can generate false alarm...
I saw this many times already. Unfortunately, some users of Inspector XE are very "scared" when they see these "errors". Instead, they should be reported by Inspector as warnings.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Mikhail,
In your test-case there are two cases when uninitialized variables are passed to IPP functions:
...
int _tmain( int argc, _TCHAR *argv[] )
{
// Initialize data
...
int image_step;
Ipp8u *src = ippiMalloc_8u_C1( image_size.width, image_size.height, &image_step );
...
// Check MorphologyInit
int state_size;
CALL_IPP_CHECKED( ippiMorphologyGetSize_8u_C1R( image_size.width, strel, strel_size, &state_size ) );
...
}
and it could be a possible reason of error messages from Inspector XE.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sergey Kostrov wrote:That's ok. The functions use those variables as write-only data (don't read, only write). So, caling these functions is, in fact, initialization of variables. Regards, Sergey
...
int _tmain( int argc, _TCHAR *argv[] )
{
// Initialize data
...
int image_step;Ipp8u *src = ippiMalloc_8u_C1( image_size.width, image_size.height, &image_step );
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
>>...The functions use those variables as write-only data (don't read, only write). So, caling these functions is, in fact,
>>initialization of variables...
I understand this and my note was regarding Inspector XE only. It looks like it detects that a variable is not initialized, reports an error and actual initialization of the variable is somewhere at the end of the function ( before a return is called ).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I don't know Inspector, it must be not static but HW-level detector. Otherwise, it could not be able to detect uninitialized memory reads in binary code like it happened in Mikhail's example, where Inspector pointed to IPP function.
Regards,
Sergey

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page