<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Uninitialized memory access in struct member padding in Analyzers</title>
    <link>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788423#M1073</link>
    <description>int foo()&lt;BR /&gt;{&lt;BR /&gt; ...&lt;BR /&gt; padd p1 &lt;SPAN style="text-decoration: underline;"&gt;= { 0x0 }&lt;/SPAN&gt;;&lt;BR /&gt; ...&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;or&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;#define new2( iSize ) calloc( 1, iSize )&lt;BR /&gt;&lt;BR /&gt;{&lt;BR /&gt; ...&lt;BR /&gt; padd *p1 = NULL;&lt;BR /&gt; p = new2( sizeof(padd ) );  //Actually, there is a &lt;STRONG&gt;&lt;SPAN style="text-decoration: underline;"&gt;big problem&lt;/SPAN&gt;&lt;/STRONG&gt;here, that is, an object constructor&lt;BR /&gt; ... // won't be called! It isnot recommended way in your case.&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;or&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;Take a look at: &lt;A href="http://software.intel.com/en-us/forums/showthread.php?t=86933"&gt;http://software.intel.com/en-us/forums/showthread.php?t=86933&lt;/A&gt;and here is some&lt;BR /&gt;stuff from the post:&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;&amp;gt;&amp;gt;&lt;STRONG&gt;...I still wonder why would one need to use malloc instead of new...&lt;/STRONG&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&lt;BR /&gt;&amp;gt;&amp;gt;To improveperformance! Becauseconstructor and destructor arenot called,memory&lt;BR /&gt;&amp;gt;&amp;gt;allocated anywayand all object attributes could beinitialized later. Icalled it &lt;STRONG&gt;Delayed&lt;BR /&gt;&lt;/STRONG&gt;&amp;gt;&amp;gt;&lt;STRONG&gt;ObjectInitialization ( DOI )&lt;/STRONG&gt;.&lt;BR /&gt;&amp;gt;&amp;gt;&lt;BR /&gt;&amp;gt;&amp;gt;So, I use that trick with a &lt;STRONG&gt;calloc&lt;/STRONG&gt; CRT-function and a C++ template, like:&lt;BR /&gt;&amp;gt;&amp;gt;&lt;BR /&gt;&amp;gt;&amp;gt;...&lt;BR /&gt;&amp;gt;&amp;gt;m_ppvRs = ( RTvoid ** )( TStrassenHBCResultSet&amp;lt; RTint &amp;gt; ** )&lt;STRONG&gt;calloc&lt;/STRONG&gt;(&lt;BR /&gt;&amp;gt;&amp;gt;m_uiNumOfPartitions,&lt;BR /&gt;&amp;gt;&amp;gt;sizeof( TStrassenHBCResultSet&amp;lt; RTint &amp;gt; * ) );&lt;BR /&gt;&amp;gt;&amp;gt;if( m_ppvRs == RTnull )&lt;BR /&gt;&amp;gt;&amp;gt; return ( RTbool )bOk;&lt;BR /&gt;&amp;gt;&amp;gt;...&lt;BR /&gt;&amp;gt;&amp;gt;&lt;BR /&gt;&amp;gt;&amp;gt;and, by default a block ofmemory is initialized to 0x0s by &lt;STRONG&gt;calloc&lt;/STRONG&gt; and I don't need to do anything!&lt;BR /&gt;...</description>
    <pubDate>Wed, 30 Nov 2011 02:04:52 GMT</pubDate>
    <dc:creator>SergeyKostrov</dc:creator>
    <dc:date>2011-11-30T02:04:52Z</dc:date>
    <item>
      <title>Uninitialized memory access in struct member padding</title>
      <link>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788410#M1060</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;We got Uninitialized memory access when the program copies structures allocating them using new keyword.&lt;BR /&gt;Inside the actual structure there are some padding bytes. (I know we should design structures to avoid padding, but we have tons of legacy sources we don't have resource to refactor old codes.) I think this is false alarm, because the programnever accesses padding bytes when reads or writes the struct members. We should differentiate or filtersomehow this kid of problems from real uninitializes memory accesses.&lt;BR /&gt;&lt;BR /&gt;Is there a way to do it?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Peter</description>
      <pubDate>Wed, 23 Nov 2011 16:38:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788410#M1060</guid>
      <dc:creator>Bada__Peter</dc:creator>
      <dc:date>2011-11-23T16:38:03Z</dc:date>
    </item>
    <item>
      <title>Uninitialized memory access in struct member padding</title>
      <link>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788411#M1061</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I just built a simple test case but I haven't seen any uninitialized memory access for padding bytes.&lt;BR /&gt;&lt;BR /&gt;Please let me know if I understood your question correctly, or you can provide a test case to help of reproducing this problem. &lt;BR /&gt;&lt;BR /&gt;I'm using Inspector XE 2011 IXE Update 7.&lt;BR /&gt;&lt;BR /&gt;Thanks, Peter&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;[cpp]# inspxe-cl -version
Intel Inspector XE 2011 Update 7 (build 189290) Command Line tool
Copyright (C) 2009-2011 Intel Corporation. All rights reserved.

/* test_uninitial_struct.c */
#include &lt;STDIO.H&gt;
struct my_struct{
int int_a;
short short_b;
short pad;
};

int main()
{
  struct my_struct *theStruct, theStruct1;

  theStruct = (struct my_struct*)malloc(sizeof(struct my_struct));
  theStruct-&amp;gt;int_a = 10;
  theStruct-&amp;gt;short_b = 20;
  memcpy(&amp;amp;theStruct1, theStruct, sizeof(struct my_struct));
  printf("integer is %d, short is %dn", theStruct1.int_a, theStruct1.short_b);

  free(theStruct);
  return 0;
}
 
# gcc -g test_uninitial_struct.c -o test_uninitial_struct
# inspxe-cl -collect mi3 -- ./test_uninitial_struct  Used suppression file(s): []
integer is 10, short is 20

0 new problem(s) found

[/cpp]&lt;/STDIO.H&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 24 Nov 2011 08:44:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788411#M1061</guid>
      <dc:creator>IDZ_A_Intel</dc:creator>
      <dc:date>2011-11-24T08:44:53Z</dc:date>
    </item>
    <item>
      <title>Uninitialized memory access in struct member padding</title>
      <link>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788412#M1062</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;Thanks for your quick answer but thereis no struct padding.&lt;BR /&gt;&lt;BR /&gt;Try this:&lt;BR /&gt;struct padd {&lt;BR /&gt;int m1;&lt;BR /&gt;bool m2;&lt;BR /&gt;// some(3)padding bytes here (0xCD or 0xCC), these are uninitilized&lt;BR /&gt;int m3;&lt;BR /&gt;};&lt;BR /&gt;// no pragma padding,I guess the default is 4&lt;BR /&gt;padd *ppadd = new padd(); // or malloc or auto&lt;BR /&gt;ppass-&amp;gt;m1 = 1;&lt;BR /&gt;ppass-&amp;gt;m2 = true;&lt;BR /&gt;ppass-&amp;gt;m3 = 2;&lt;BR /&gt;&lt;BR /&gt;If you dump the ppadd, you can see that there are 0xcd (or 0xcc) bytesbetween m2 and m3.&lt;BR /&gt;I see these bytes in my debugger after the allocation and where the Inspector signs the problem.&lt;BR /&gt;We use VS2010 x64 compiler linker and Inspector XE 2011 Update 7&lt;BR /&gt;At copy contructorsor simple struct copy Inspector always displays red memory problem even all struct member were initialized properly.&lt;BR /&gt;&lt;BR /&gt;The real problem is that during one of our regression test we got 100 uninit problems but 97-98 are this kind.&lt;BR /&gt;What is your observation in this case?&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Peter&lt;/P&gt;</description>
      <pubDate>Fri, 25 Nov 2011 12:57:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788412#M1062</guid>
      <dc:creator>Bada__Peter</dc:creator>
      <dc:date>2011-11-25T12:57:36Z</dc:date>
    </item>
    <item>
      <title>Uninitialized memory access in struct member padding</title>
      <link>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788413#M1063</link>
      <description>What is your default alignment? It looks like 4 bytes. So,a C/C++ compiler is trying to align all struct members, especially m3 int type member,and this is a correct action. I would consider small code modifications andhere are two possiblesolutions:&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;// Solution 1&lt;/STRONG&gt;&lt;BR /&gt;...&lt;BR /&gt; struct padd&lt;BR /&gt; {&lt;BR /&gt;  int m1;&lt;BR /&gt;  int m3;&lt;BR /&gt;  bool m2;&lt;BR /&gt; }&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;// Solution 2&lt;/STRONG&gt;&lt;BR /&gt;...&lt;BR /&gt; struct padd&lt;BR /&gt; {&lt;BR /&gt;  int m1;&lt;BR /&gt;  bool m2;&lt;BR /&gt;  bool dummy[3]; // needs to be initialized with 0x0later&lt;BR /&gt; int m3;&lt;BR /&gt; }&lt;BR /&gt;...&lt;BR /&gt;</description>
      <pubDate>Fri, 25 Nov 2011 14:24:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788413#M1063</guid>
      <dc:creator>SergeyKostrov</dc:creator>
      <dc:date>2011-11-25T14:24:52Z</dc:date>
    </item>
    <item>
      <title>Uninitialized memory access in struct member padding</title>
      <link>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788414#M1064</link>
      <description>Sergey,&lt;BR /&gt;&lt;BR /&gt;Finally I can reproduce this problem, but I don't think that this is a bug of Inspector XE!&lt;BR /&gt;&lt;BR /&gt;If I insertedthe dummy tomy structure, and copy this structure to otherspace - actually dummy has been accessed and not initialized, detected by Inspector XE.&lt;BR /&gt;&lt;BR /&gt;&lt;P&gt;# inspxe-cl -collect mi3 -- ./test_uninitial_struct Used suppression file(s): []&lt;BR /&gt;integer a is 10, integer c is 20, bool is 1&lt;/P&gt;&lt;P&gt;2 new problem(s) found&lt;BR /&gt; 1 Uninitialized memory access problem(s) detected&lt;BR /&gt; 1 Uninitialized partial memory access problem(s) detected&lt;/P&gt;The scenario is - the user has to copy data structure in the project, many places. Theuser won't see these unnecessary error reports (dummy uninitialized), because the user never uses these dummys.&lt;BR /&gt;&lt;BR /&gt;The request is - how to filter theseunintialized error reports? Use Suppression? Sometime isnot feasible,if there are hundred errors.&lt;BR /&gt;&lt;BR /&gt;Orcan we exclude "uninitialized accesses" from mi2/m3 ?&lt;BR /&gt;&lt;BR /&gt;Regards, Peter Wang&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;[cpp]#include &lt;STDIO.H&gt;

typedef enum { true=1, false=0} bool;
struct my_struct{
int int_a;
bool bool_b;
bool dummy[3];
int int_c;
};

int main()
{
  int i;
  struct my_struct *theStruct, theStruct1;

  theStruct = (struct my_struct*)malloc(sizeof(struct my_struct));
  theStruct-&amp;gt;int_a = 10;
  theStruct-&amp;gt;int_c = 20;
  theStruct-&amp;gt;bool_b = true;

  /*
   for (i=0; i&amp;lt;3; i++) theStruct-&amp;gt;dummy&lt;I&gt;= false;
   */

  memcpy(&amp;amp;theStruct1, theStruct, sizeof(struct my_struct));
  printf("integer a is %d, integer c is %d, bool is %dn", theStruct1.int_a, theStruct1.int_c, theStruct1.bool_b);


  free(theStruct);
  return 0;
}
[/cpp]&lt;/I&gt;&lt;/STDIO.H&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 26 Nov 2011 02:46:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788414#M1064</guid>
      <dc:creator>Peter_W_Intel</dc:creator>
      <dc:date>2011-11-26T02:46:01Z</dc:date>
    </item>
    <item>
      <title>Uninitialized memory access in struct member padding</title>
      <link>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788415#M1065</link>
      <description>Here is another idea:&lt;BR /&gt;&lt;BR /&gt;You could try to use &lt;STRONG&gt;calloc&lt;/STRONG&gt; CRT-function instead of &lt;STRONG&gt;malloc&lt;/STRONG&gt;. By default, &lt;STRONG&gt;calloc&lt;/STRONG&gt; initializesallocated memory with zeros ( 0x0 ). But,&lt;STRONG&gt;calloc&lt;/STRONG&gt; is a little bit &lt;SPAN style="text-decoration: underline;"&gt;slower&lt;/SPAN&gt; than &lt;STRONG&gt;malloc&lt;/STRONG&gt;andhas two arguments.So, you will need a macro-wrapper. Anyway,this is how it could look like:&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;#define &lt;STRONG&gt;malloc2&lt;/STRONG&gt;( iSize ) &lt;STRONG&gt;calloc&lt;/STRONG&gt;( 1, iSize )&lt;BR /&gt;...&lt;BR /&gt;theStruct=( structmy_struct * )&lt;STRONG&gt;malloc2&lt;/STRONG&gt;( sizeof( structmy_struct ) );&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;Take a look at &lt;STRONG&gt;MSDN&lt;/STRONG&gt; for more technical detailson&lt;STRONG&gt;calloc&lt;/STRONG&gt; CRT-function.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Sergey&lt;BR /&gt;</description>
      <pubDate>Sat, 26 Nov 2011 05:43:42 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788415#M1065</guid>
      <dc:creator>SergeyKostrov</dc:creator>
      <dc:date>2011-11-26T05:43:42Z</dc:date>
    </item>
    <item>
      <title>Uninitialized memory access in struct member padding</title>
      <link>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788416#M1066</link>
      <description>Hi All,&lt;BR /&gt;&lt;BR /&gt;Thanks for your suggestion. We know how we could suppress (henceforward I think it is false) alarms with additional work changing the sources. Redesing structures (insert dummy fields) could be a huge effort. (we develop image processing and OCR engines, millions lines of pretty old but working sources. We inherited them from earlier companies.)&lt;BR /&gt;&lt;BR /&gt;In new sources structures are designed without pack sensivity and without padding spaces.&lt;BR /&gt;&lt;BR /&gt;It is a good idea to use zero init allocation but it hides the real uninitialization problems. The situtation could better, because the program will always behave same wayand there is a better chance to debug the actual problem (except stackvariables)But in this case Inspector would be unnecessary finding uninitialized struct and class members.&lt;BR /&gt;&lt;BR /&gt;Many thanks,&lt;BR /&gt;Peter</description>
      <pubDate>Sat, 26 Nov 2011 10:38:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788416#M1066</guid>
      <dc:creator>Bada__Peter</dc:creator>
      <dc:date>2011-11-26T10:38:53Z</dc:date>
    </item>
    <item>
      <title>Uninitialized memory access in struct member padding</title>
      <link>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788417#M1067</link>
      <description>&lt;DIV id="tiny_quote"&gt;&lt;DIV style="margin-left: 2px; margin-right: 2px;"&gt;Quoting &lt;A jquery1322303800796="53" rel="/en-us/services/profile/quick_profile.php?is_paid=&amp;amp;user_id=353541" href="https://community.intel.com/en-us/profile/353541/" class="basic"&gt;Sergey Kostrov&lt;/A&gt;&lt;/DIV&gt;&lt;DIV style="background-color: #e5e5e5; margin-left: 2px; margin-right: 2px; border: 1px inset; padding: 5px;"&gt;&lt;I&gt;Here is another idea:&lt;BR /&gt;&lt;BR /&gt;You could try to use &lt;STRONG&gt;calloc&lt;/STRONG&gt; CRT-function instead of &lt;STRONG&gt;malloc&lt;/STRONG&gt;. By default, &lt;STRONG&gt;calloc&lt;/STRONG&gt; initializesallocated memory with zeros ( 0x0 ). But,&lt;STRONG&gt;calloc&lt;/STRONG&gt; is a little bit &lt;SPAN style="text-decoration: underline;"&gt;slower&lt;/SPAN&gt; than &lt;STRONG&gt;malloc&lt;/STRONG&gt;andhas two arguments.So, you will need a macro-wrapper. Anyway,this is how it could look like:&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;#define &lt;STRONG&gt;malloc2&lt;/STRONG&gt;( iSize ) &lt;STRONG&gt;calloc&lt;/STRONG&gt;( 1, iSize )&lt;BR /&gt;...&lt;BR /&gt;theStruct=( structmy_struct * )&lt;STRONG&gt;malloc2&lt;/STRONG&gt;( sizeof( structmy_struct ) );&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;Take a look at &lt;STRONG&gt;MSDN&lt;/STRONG&gt; for more technical detailson&lt;STRONG&gt;calloc&lt;/STRONG&gt; CRT-function.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Sergey&lt;BR /&gt;&lt;/I&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;This is a great idea of using calloc instead of malloc, for initialization.&lt;BR /&gt;&lt;BR /&gt;Thanks Sergey!&lt;BR /&gt;&lt;BR /&gt;Regards, Peter</description>
      <pubDate>Sat, 26 Nov 2011 10:39:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788417#M1067</guid>
      <dc:creator>Peter_W_Intel</dc:creator>
      <dc:date>2011-11-26T10:39:13Z</dc:date>
    </item>
    <item>
      <title>Uninitialized memory access in struct member padding</title>
      <link>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788418#M1068</link>
      <description>Peter,&lt;BR /&gt;&lt;BR /&gt;Supressing or filtering both are OK for us. Changing structures is risky. We always fighting with OCR accuracy. Small changes in the code could cause significant changes on the output. This is a real pain of old legacy modules.&lt;BR /&gt;Currently we don't have time to refactor old stuff. I know we should do it somehow sometime in the near future, but I would like to make some improvements using great tool: Inspector.&lt;BR /&gt;The actual problem with this (let say not 100% accurate or not valid) alarm is the developer got 40-50 uninit problems. He or she starts to investigate them and the first 10 issue are not a real problem for them. In addition it is not obvoius. He see in the reportthere areuninit members but they don't understand (because it is false). I suggest them todebug to the certain line of source code wher Inspector signs and dump actual the structure and inspect the memory dump to hunt 0xcd. If there is 0xcdensure they are padding bytes only. So after a while they easy give up, because of unnecessary work.&lt;BR /&gt;I usually force this work because Inspector found some real and valid uninint problems what is great for us. But it could be much better.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;Peter</description>
      <pubDate>Sat, 26 Nov 2011 10:59:55 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788418#M1068</guid>
      <dc:creator>Bada__Peter</dc:creator>
      <dc:date>2011-11-26T10:59:55Z</dc:date>
    </item>
    <item>
      <title>Uninitialized memory access in struct member padding</title>
      <link>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788419#M1069</link>
      <description>With respect: It is great idea, if we want to suppress not to find certain uninit problems. I think...</description>
      <pubDate>Sat, 26 Nov 2011 11:12:17 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788419#M1069</guid>
      <dc:creator>Bada__Peter</dc:creator>
      <dc:date>2011-11-26T11:12:17Z</dc:date>
    </item>
    <item>
      <title>Uninitialized memory access in struct member padding</title>
      <link>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788420#M1070</link>
      <description>Peter ( I mean the owner of the thread ),&lt;BR /&gt;&lt;BR /&gt;In myprevious postI've suggested an ideaofusing the &lt;STRONG&gt;calloc&lt;/STRONG&gt; CRT-function instead of &lt;STRONG&gt;malloc&lt;/STRONG&gt; through&lt;BR /&gt;the &lt;STRONG&gt;malloc2&lt;/STRONG&gt; macro.&lt;BR /&gt;&lt;BR /&gt;Sorry, one more time, the &lt;STRONG&gt;calloc&lt;/STRONG&gt; function will initialize &lt;SPAN style="text-decoration: underline;"&gt;all members of a structure to zeros&lt;/SPAN&gt;as soon&lt;BR /&gt;as memory allocated and Intel'sInspector won't see any problems ( that is, uninitialized bytes ).&lt;BR /&gt;&lt;BR /&gt;In your case with "uninitialized-padded-bytes"some source codesmodifications are &lt;STRONG&gt;inevitable&lt;/STRONG&gt; but&lt;BR /&gt;with the &lt;STRONG&gt;malloc2&lt;/STRONG&gt; macro &lt;SPAN style="text-decoration: underline;"&gt;you don't need to change&lt;/SPAN&gt; structures.&lt;BR /&gt;&lt;BR /&gt;You could also use a &lt;SPAN style="text-decoration: underline;"&gt;more dangerous&lt;/SPAN&gt; way ofusing a &lt;STRONG&gt;_declspec( align(1) )&lt;/STRONG&gt; directive before&lt;BR /&gt;declaration of astructure and in that case none of bytes will be padded. But, it is possible that&lt;STRONG&gt;push()&lt;BR /&gt;&lt;/STRONG&gt;and &lt;STRONG&gt;pop()&lt;/STRONG&gt; directives will need to used to save and restorecurrent alignments of codes.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Sergey&lt;BR /&gt;</description>
      <pubDate>Sun, 27 Nov 2011 03:09:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788420#M1070</guid>
      <dc:creator>SergeyKostrov</dc:creator>
      <dc:date>2011-11-27T03:09:01Z</dc:date>
    </item>
    <item>
      <title>Uninitialized memory access in struct member padding</title>
      <link>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788421#M1071</link>
      <description>Here is another way of eliminatingpadded bytes in a structure...&lt;BR /&gt;&lt;BR /&gt;In order to provide a completebinary-compatibility of some data structures a &lt;STRONG&gt;#pragma pack( n )&lt;/STRONG&gt; directive&lt;BR /&gt;could be used beforedeclaration of a structure. After modification(s)appliedcodes have to be tested as&lt;BR /&gt;better as possible.&lt;BR /&gt;&lt;BR /&gt;Take a look at MSDN's article "C/C++ Preprocessor Reference" for &lt;STRONG&gt;pack( n )&lt;/STRONG&gt; keyword.&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;&lt;STRONG&gt;// Let's say default alignment of an applicationis 4...&lt;/STRONG&gt;&lt;BR /&gt;...&lt;BR /&gt;#pragma pack( 1 )&lt;BR /&gt;typedef struct tagTESTDATA&lt;BR /&gt;{&lt;BR /&gt; int m1;&lt;BR /&gt; bool m2;&lt;BR /&gt; int m3;&lt;BR /&gt;}TESTDATA;&lt;BR /&gt;#pragma pack()&lt;BR /&gt;&lt;STRONG&gt;// Restores default alignment...&lt;/STRONG&gt;&lt;BR /&gt;...&lt;BR /&gt;void &lt;STRONG&gt;main&lt;/STRONG&gt;( void )&lt;BR /&gt;{&lt;BR /&gt; TESTDATA td;&lt;BR /&gt; td.m1 = 0x22222222;&lt;BR /&gt; td.m2 = true;&lt;BR /&gt; td.m3 = 0x33333333;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;A memory dump of '&lt;STRONG&gt;td&lt;/STRONG&gt;' variable forthe application compiled&lt;SPAN style="text-decoration: underline;"&gt;with&lt;/SPAN&gt; #pragma pack( 1 ) directive:&lt;BR /&gt;...&lt;BR /&gt;222222220133333333&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;A memory dump of '&lt;STRONG&gt;td&lt;/STRONG&gt;' variable for the application compiled&lt;SPAN style="text-decoration: underline;"&gt;without&lt;/SPAN&gt; #pragma pack( 1 ) directive:&lt;BR /&gt;...&lt;BR /&gt;2222222201&lt;SPAN style="text-decoration: underline;"&gt;cccccc&lt;/SPAN&gt;33333333&lt;BR /&gt;...&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Sergey&lt;BR /&gt;</description>
      <pubDate>Tue, 29 Nov 2011 01:53:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788421#M1071</guid>
      <dc:creator>SergeyKostrov</dc:creator>
      <dc:date>2011-11-29T01:53:18Z</dc:date>
    </item>
    <item>
      <title>Uninitialized memory access in struct member padding</title>
      <link>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788422#M1072</link>
      <description>Sergey,&lt;BR /&gt;&lt;BR /&gt;Thank you for your advices. We know calloc. But using calloc we hide the real uninitialized memory access. Evenfrom Inspector.The program will not certainly work correctly with zero init. If the algorithm was contructed assuming zero init, it is ok, but in other cases zero allocated memory is uninitialized from the algorithm point of view. In addition Inspector does not have a chance to sign the real problem. We just hide the problem.&lt;BR /&gt;&lt;BR /&gt;And what aboutauto(stack)variables or new?&lt;BR /&gt;&lt;BR /&gt;int foo()&lt;BR /&gt;{&lt;BR /&gt; padd p1;&lt;BR /&gt;.&lt;BR /&gt;or&lt;BR /&gt;.&lt;BR /&gt; padd *p1;&lt;BR /&gt; p1 = new padd(); //We can use calloc only if we override new and placement new&lt;BR /&gt;.&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;Changing pack()(push/pop)in old sourcesis realy dangerous as you said.There is no plan to be resources forsuch changes. It is serious like changing the order of the members or adding padd dummies.&lt;BR /&gt;May be you are right, some how we should refactor our structures. It would be worth in long term.&lt;BR /&gt;As I see Inspector will notaddress this problem.&lt;BR /&gt;&lt;BR /&gt;Thank you, Sergey.</description>
      <pubDate>Tue, 29 Nov 2011 13:55:44 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788422#M1072</guid>
      <dc:creator>Bada__Peter</dc:creator>
      <dc:date>2011-11-29T13:55:44Z</dc:date>
    </item>
    <item>
      <title>Uninitialized memory access in struct member padding</title>
      <link>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788423#M1073</link>
      <description>int foo()&lt;BR /&gt;{&lt;BR /&gt; ...&lt;BR /&gt; padd p1 &lt;SPAN style="text-decoration: underline;"&gt;= { 0x0 }&lt;/SPAN&gt;;&lt;BR /&gt; ...&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;or&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;#define new2( iSize ) calloc( 1, iSize )&lt;BR /&gt;&lt;BR /&gt;{&lt;BR /&gt; ...&lt;BR /&gt; padd *p1 = NULL;&lt;BR /&gt; p = new2( sizeof(padd ) );  //Actually, there is a &lt;STRONG&gt;&lt;SPAN style="text-decoration: underline;"&gt;big problem&lt;/SPAN&gt;&lt;/STRONG&gt;here, that is, an object constructor&lt;BR /&gt; ... // won't be called! It isnot recommended way in your case.&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;or&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;Take a look at: &lt;A href="http://software.intel.com/en-us/forums/showthread.php?t=86933"&gt;http://software.intel.com/en-us/forums/showthread.php?t=86933&lt;/A&gt;and here is some&lt;BR /&gt;stuff from the post:&lt;BR /&gt;&lt;BR /&gt;...&lt;BR /&gt;&amp;gt;&amp;gt;&lt;STRONG&gt;...I still wonder why would one need to use malloc instead of new...&lt;/STRONG&gt;&lt;BR /&gt;&amp;gt;&amp;gt;&lt;BR /&gt;&amp;gt;&amp;gt;To improveperformance! Becauseconstructor and destructor arenot called,memory&lt;BR /&gt;&amp;gt;&amp;gt;allocated anywayand all object attributes could beinitialized later. Icalled it &lt;STRONG&gt;Delayed&lt;BR /&gt;&lt;/STRONG&gt;&amp;gt;&amp;gt;&lt;STRONG&gt;ObjectInitialization ( DOI )&lt;/STRONG&gt;.&lt;BR /&gt;&amp;gt;&amp;gt;&lt;BR /&gt;&amp;gt;&amp;gt;So, I use that trick with a &lt;STRONG&gt;calloc&lt;/STRONG&gt; CRT-function and a C++ template, like:&lt;BR /&gt;&amp;gt;&amp;gt;&lt;BR /&gt;&amp;gt;&amp;gt;...&lt;BR /&gt;&amp;gt;&amp;gt;m_ppvRs = ( RTvoid ** )( TStrassenHBCResultSet&amp;lt; RTint &amp;gt; ** )&lt;STRONG&gt;calloc&lt;/STRONG&gt;(&lt;BR /&gt;&amp;gt;&amp;gt;m_uiNumOfPartitions,&lt;BR /&gt;&amp;gt;&amp;gt;sizeof( TStrassenHBCResultSet&amp;lt; RTint &amp;gt; * ) );&lt;BR /&gt;&amp;gt;&amp;gt;if( m_ppvRs == RTnull )&lt;BR /&gt;&amp;gt;&amp;gt; return ( RTbool )bOk;&lt;BR /&gt;&amp;gt;&amp;gt;...&lt;BR /&gt;&amp;gt;&amp;gt;&lt;BR /&gt;&amp;gt;&amp;gt;and, by default a block ofmemory is initialized to 0x0s by &lt;STRONG&gt;calloc&lt;/STRONG&gt; and I don't need to do anything!&lt;BR /&gt;...</description>
      <pubDate>Wed, 30 Nov 2011 02:04:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/Uninitialized-memory-access-in-struct-member-padding/m-p/788423#M1073</guid>
      <dc:creator>SergeyKostrov</dc:creator>
      <dc:date>2011-11-30T02:04:52Z</dc:date>
    </item>
  </channel>
</rss>

