<?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 &amp;quot;Invalid memory access&amp;quot; deteced when using std::map ? in Analyzers</title>
    <link>https://community.intel.com/t5/Analyzers/quot-Invalid-memory-access-quot-deteced-when-using-std-map/m-p/970109#M9395</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I use a std::map (from #include&amp;nbsp;&amp;lt;map&amp;gt; ) in my Code (see minimal example below).&lt;/P&gt;
&lt;P&gt;After compiling with the Intel Composer 2013 I analyzed my program with the Intel Inspector XE.&amp;nbsp; I got various "Invalid Memory Access" errors. The errors are located in "xmemory", which is not from me. The last line in my Code is a call to the std::map.&lt;/P&gt;
&lt;P&gt;If I compile with the&amp;nbsp;Mircosoft compiler, integrated in Visual Studio 2010, and analyzed my program the Intel Inspector&amp;nbsp; does not find any Error.&lt;/P&gt;
&lt;P&gt;Question: Is that...&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&amp;nbsp;.. a problem in the code?&lt;/LI&gt;
&lt;LI&gt;... a problem of the std::map implementation?&lt;/LI&gt;
&lt;LI&gt;.. just a false positive from the Inspector?&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Please find attached a example Visual Studio (2010) project. Inclusive an Inspector result with the problems.&lt;/P&gt;
&lt;P&gt;Compiler settings are default of Visual Studio (for Debug mode), but for x64 and with the Intel compiler.&lt;/P&gt;
&lt;P&gt;My minimal code example: (copied from &lt;A href="http://www.yolinux.com/TUTORIALS/CppStlMultiMap.html"&gt;here&lt;/A&gt;)&lt;/P&gt;
&lt;P&gt;[cpp]#include &amp;lt;string&amp;gt;&lt;BR /&gt;#include &amp;lt;iostream&amp;gt;&lt;BR /&gt;#include &amp;lt;map&amp;gt;&lt;BR /&gt;#include &amp;lt;utility&amp;gt;&lt;BR /&gt;&lt;BR /&gt;using namespace std;&lt;BR /&gt;&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; map&amp;lt;string, int*&amp;gt; Employees;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; int a = 5234;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; int b = 3374;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; int c = 1923;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; int d = 7582;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; // Examples of assigning Map container contents&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; // 1) Assignment using array index notation&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Employees["Mike C."] = &amp;amp;a;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Employees["Charlie M."] = &amp;amp;b;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; // 2) Assignment using member function insert() and STL pair&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Employees.insert(std::pair&amp;lt;string,int*&amp;gt;("David D.",&amp;amp;c)); //makes 3 "Invalid memory access"&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; // 3) Assignment using member function insert() and "value_type()"&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Employees.insert(map&amp;lt;string,int*&amp;gt;::value_type("John A.",&amp;amp;d));&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; // 4) Assignment using member function insert() and "make_pair()"&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Employees.insert(std::pair&amp;lt;string, int*&amp;gt;("Peter Q.",&amp;amp;d));&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; cout &amp;lt;&amp;lt; "Map size: " &amp;lt;&amp;lt; Employees.size() &amp;lt;&amp;lt; endl;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; for( map&amp;lt;string, int*&amp;gt;::iterator ii=Employees.begin(); ii!=Employees.end(); ++ii)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cout &amp;lt;&amp;lt; (*ii).first &amp;lt;&amp;lt; ": " &amp;lt;&amp;lt; *(*ii).second &amp;lt;&amp;lt; endl;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;}&lt;BR /&gt;[/cpp]&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Platform/Tools:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Windows 7&lt;/LI&gt;
&lt;LI&gt;Visual Studio 2010&lt;/LI&gt;
&lt;LI&gt;Intel® C++ Composer XE 2013 Update 5 Integration for Microsoft* Visual Studio* 2010&lt;/LI&gt;
&lt;LI&gt;Intel® Inspector XE 2013 Update 6, (build 283349)&lt;/LI&gt;
&lt;/UL&gt;</description>
    <pubDate>Tue, 06 Aug 2013 15:38:54 GMT</pubDate>
    <dc:creator>Jonas_M_</dc:creator>
    <dc:date>2013-08-06T15:38:54Z</dc:date>
    <item>
      <title>"Invalid memory access" deteced when using std::map ?</title>
      <link>https://community.intel.com/t5/Analyzers/quot-Invalid-memory-access-quot-deteced-when-using-std-map/m-p/970109#M9395</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;I use a std::map (from #include&amp;nbsp;&amp;lt;map&amp;gt; ) in my Code (see minimal example below).&lt;/P&gt;
&lt;P&gt;After compiling with the Intel Composer 2013 I analyzed my program with the Intel Inspector XE.&amp;nbsp; I got various "Invalid Memory Access" errors. The errors are located in "xmemory", which is not from me. The last line in my Code is a call to the std::map.&lt;/P&gt;
&lt;P&gt;If I compile with the&amp;nbsp;Mircosoft compiler, integrated in Visual Studio 2010, and analyzed my program the Intel Inspector&amp;nbsp; does not find any Error.&lt;/P&gt;
&lt;P&gt;Question: Is that...&lt;/P&gt;
&lt;OL&gt;
&lt;LI&gt;&amp;nbsp;.. a problem in the code?&lt;/LI&gt;
&lt;LI&gt;... a problem of the std::map implementation?&lt;/LI&gt;
&lt;LI&gt;.. just a false positive from the Inspector?&lt;/LI&gt;
&lt;/OL&gt;
&lt;P&gt;Please find attached a example Visual Studio (2010) project. Inclusive an Inspector result with the problems.&lt;/P&gt;
&lt;P&gt;Compiler settings are default of Visual Studio (for Debug mode), but for x64 and with the Intel compiler.&lt;/P&gt;
&lt;P&gt;My minimal code example: (copied from &lt;A href="http://www.yolinux.com/TUTORIALS/CppStlMultiMap.html"&gt;here&lt;/A&gt;)&lt;/P&gt;
&lt;P&gt;[cpp]#include &amp;lt;string&amp;gt;&lt;BR /&gt;#include &amp;lt;iostream&amp;gt;&lt;BR /&gt;#include &amp;lt;map&amp;gt;&lt;BR /&gt;#include &amp;lt;utility&amp;gt;&lt;BR /&gt;&lt;BR /&gt;using namespace std;&lt;BR /&gt;&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; map&amp;lt;string, int*&amp;gt; Employees;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; int a = 5234;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; int b = 3374;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; int c = 1923;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; int d = 7582;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; // Examples of assigning Map container contents&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; // 1) Assignment using array index notation&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Employees["Mike C."] = &amp;amp;a;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Employees["Charlie M."] = &amp;amp;b;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; // 2) Assignment using member function insert() and STL pair&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Employees.insert(std::pair&amp;lt;string,int*&amp;gt;("David D.",&amp;amp;c)); //makes 3 "Invalid memory access"&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; // 3) Assignment using member function insert() and "value_type()"&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Employees.insert(map&amp;lt;string,int*&amp;gt;::value_type("John A.",&amp;amp;d));&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; // 4) Assignment using member function insert() and "make_pair()"&lt;BR /&gt;&amp;nbsp;&amp;nbsp; Employees.insert(std::pair&amp;lt;string, int*&amp;gt;("Peter Q.",&amp;amp;d));&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; cout &amp;lt;&amp;lt; "Map size: " &amp;lt;&amp;lt; Employees.size() &amp;lt;&amp;lt; endl;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; for( map&amp;lt;string, int*&amp;gt;::iterator ii=Employees.begin(); ii!=Employees.end(); ++ii)&lt;BR /&gt;&amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; cout &amp;lt;&amp;lt; (*ii).first &amp;lt;&amp;lt; ": " &amp;lt;&amp;lt; *(*ii).second &amp;lt;&amp;lt; endl;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; }&lt;BR /&gt;}&lt;BR /&gt;[/cpp]&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Platform/Tools:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;Windows 7&lt;/LI&gt;
&lt;LI&gt;Visual Studio 2010&lt;/LI&gt;
&lt;LI&gt;Intel® C++ Composer XE 2013 Update 5 Integration for Microsoft* Visual Studio* 2010&lt;/LI&gt;
&lt;LI&gt;Intel® Inspector XE 2013 Update 6, (build 283349)&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Tue, 06 Aug 2013 15:38:54 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/quot-Invalid-memory-access-quot-deteced-when-using-std-map/m-p/970109#M9395</guid>
      <dc:creator>Jonas_M_</dc:creator>
      <dc:date>2013-08-06T15:38:54Z</dc:date>
    </item>
    <item>
      <title>I can reproduce it, and will</title>
      <link>https://community.intel.com/t5/Analyzers/quot-Invalid-memory-access-quot-deteced-when-using-std-map/m-p/970110#M9396</link>
      <description>&lt;P&gt;I can reproduce it, and will look into it further (these are false positives from IXE).&lt;/P&gt;
&lt;P&gt;There is an unrelated issue in the project settings. Under Properties-&amp;gt;C/C++-&amp;gt;Code Generation, the "Basic Runtime Checks" should be turned off (set to "Default").&amp;nbsp;&amp;nbsp; In particular, the stack frames check (/RTCs) will initialize the stack to some non-zero value, and IXE will then consider the stack to be initialized.&amp;nbsp;&amp;nbsp; With this property change, IXE is able to find uninitialized accesses introduced into the example (for instance, change "int a = 5234;" to "int a;")&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2013 20:24:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/quot-Invalid-memory-access-quot-deteced-when-using-std-map/m-p/970110#M9396</guid>
      <dc:creator>Mark_D_Intel</dc:creator>
      <dc:date>2013-08-06T20:24:39Z</dc:date>
    </item>
    <item>
      <title>Thanks for your answer and</title>
      <link>https://community.intel.com/t5/Analyzers/quot-Invalid-memory-access-quot-deteced-when-using-std-map/m-p/970111#M9397</link>
      <description>&lt;P&gt;Thanks for your answer and explanation.&lt;/P&gt;
&lt;P&gt;I think the point with the project settings is not &lt;EM&gt;unrelated&lt;/EM&gt;. With turned off "Basic Runtime Checks" I get no errors shown&amp;nbsp;anymore by the Inspector.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2013 12:52:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/quot-Invalid-memory-access-quot-deteced-when-using-std-map/m-p/970111#M9397</guid>
      <dc:creator>Jonas_M_</dc:creator>
      <dc:date>2013-08-07T12:52:16Z</dc:date>
    </item>
    <item>
      <title>I could not reproduce the</title>
      <link>https://community.intel.com/t5/Analyzers/quot-Invalid-memory-access-quot-deteced-when-using-std-map/m-p/970112#M9398</link>
      <description>I could not reproduce the problem when &lt;STRONG&gt;Default&lt;/STRONG&gt; compiler options were used:

&lt;STRONG&gt;[ Debug ]&lt;/STRONG&gt;

..\Tests&amp;gt;&lt;STRONG&gt;icl.exe /MDd Test035.cpp&lt;/STRONG&gt;
...
..\Tests&amp;gt;&lt;STRONG&gt;Test035.exe&lt;/STRONG&gt;
Map size: 5
Charlie M.: 3374
David D.: 1923
John A.: 7582
Mike C.: 5234
Peter Q.: 7582

&lt;STRONG&gt;[ Release ]&lt;/STRONG&gt;

..\Tests&amp;gt;&lt;STRONG&gt;icl.exe /MD Test035.cpp&lt;/STRONG&gt;
...
..\Tests&amp;gt;&lt;STRONG&gt;Test035.exe&lt;/STRONG&gt;
Map size: 5
Charlie M.: 3374
David D.: 1923
John A.: 7582
Mike C.: 5234
Peter Q.: 7582</description>
      <pubDate>Mon, 12 Aug 2013 13:56:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/quot-Invalid-memory-access-quot-deteced-when-using-std-map/m-p/970112#M9398</guid>
      <dc:creator>SergeyKostrov</dc:creator>
      <dc:date>2013-08-12T13:56:00Z</dc:date>
    </item>
    <item>
      <title>Sergey your are showing the</title>
      <link>https://community.intel.com/t5/Analyzers/quot-Invalid-memory-access-quot-deteced-when-using-std-map/m-p/970113#M9399</link>
      <description>&lt;P&gt;Sergey your are showing the output of program. But the output of the program was &lt;STRONG&gt;not&lt;/STRONG&gt; the problem. The output was always correct.&lt;/P&gt;
&lt;P&gt;The problem was the output of the Intel Inspector Tool. The Inspector had detected some "Invalid Memory Access" inside a file called "xmemory" which is releated to the std::map. &lt;/P&gt;</description>
      <pubDate>Mon, 12 Aug 2013 14:04:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/quot-Invalid-memory-access-quot-deteced-when-using-std-map/m-p/970113#M9399</guid>
      <dc:creator>Jonas_M_</dc:creator>
      <dc:date>2013-08-12T14:04:31Z</dc:date>
    </item>
    <item>
      <title>&gt;&gt;Question: Is that...</title>
      <link>https://community.intel.com/t5/Analyzers/quot-Invalid-memory-access-quot-deteced-when-using-std-map/m-p/970114#M9400</link>
      <description>&amp;gt;&amp;gt;Question: Is that...
&amp;gt;&amp;gt;
&amp;gt;&amp;gt;1. .. a problem in the code?

The test case looks right.

&amp;gt;&amp;gt;2.... a problem of the std::map implementation?

This is a long story and compiler warnings related to &lt;STRONG&gt;xmemory&lt;/STRONG&gt; header file first time were reported in 1998 ( by Microsoft Visual C++ version 6 ).

&amp;gt;&amp;gt;3... just a false positive from the Inspector?

Try to use VS Debugger to verify that nothing is wrong with the "suspected" codes when compiled with Intel C++ compiler.</description>
      <pubDate>Tue, 13 Aug 2013 17:12:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/quot-Invalid-memory-access-quot-deteced-when-using-std-map/m-p/970114#M9400</guid>
      <dc:creator>SergeyKostrov</dc:creator>
      <dc:date>2013-08-13T17:12:52Z</dc:date>
    </item>
  </channel>
</rss>

