<?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 Could you print out the in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/double-parameter-not-copying-correctly/m-p/939897#M16860</link>
    <description>&lt;P&gt;Could you print out the assembly code for the function call and entry point and send them for us? In addition, you might want to try compiling with a lower optimization level to see if the code works in that case.&lt;/P&gt;</description>
    <pubDate>Mon, 08 Jul 2013 19:18:01 GMT</pubDate>
    <dc:creator>Frances_R_Intel</dc:creator>
    <dc:date>2013-07-08T19:18:01Z</dc:date>
    <item>
      <title>double parameter not copying correctly</title>
      <link>https://community.intel.com/t5/Software-Archive/double-parameter-not-copying-correctly/m-p/939896#M16859</link>
      <description>&lt;P&gt;We are attempting to use the rapidjson project (&lt;A href="https://code.google.com/p/rapidjson/"&gt;https://code.google.com/p/rapidjson/&lt;/A&gt;)&amp;nbsp;to parse through a json file, but we get a segfault when running it natively on the Xeon Phi Linux enviroment. &amp;nbsp;It runs fine on the Xeon chip, however. &amp;nbsp;The segfault occurs in the following lines of code in the rapidjson project:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;reader.h&lt;/P&gt;
&lt;P&gt;[cpp]&lt;/P&gt;
&lt;P&gt;d *= internal::Pow10(exp + expFrac);&lt;BR /&gt;handler.Double(minus ? -d : d);&lt;/P&gt;
&lt;P&gt;[/cpp]&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;document.h&lt;/P&gt;
&lt;P&gt;[cpp]&lt;/P&gt;
&lt;P&gt;//this is the function that is called above&lt;/P&gt;
&lt;P&gt;void Double(double d) { new (stack_.template Push&amp;lt;ValueType&amp;gt;()) ValueType(d); }&lt;/P&gt;
&lt;P&gt;[/cpp]&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I don't have a clue what the .template Push is doing, in fact i have never even seen syntax like that. Regardless, i don't believe this to be the source of the issue, as when i use gdb to debug through it, the error is occurring because in document.h, "d" being passed in to void Double is some random double (like 3.34155418345e-317) with the address of 0x0. &amp;nbsp;GDB output is below:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Breakpoint 1, rapidjson::GenericReader&amp;lt;rapidjson::UTF8&amp;lt;char&amp;gt;, rapidjson::MemoryPoolAllocator&amp;lt;rapidjson::CrtAllocator&amp;gt; &amp;gt;::ParseNumber&amp;lt;1u, rapidjson::GenericInsituStringStream&amp;lt;rapidjson::UTF8&amp;lt;char&amp;gt; &amp;gt;, rapidjson::GenericDocument&amp;lt;rapidjson::UTF8&amp;lt;char&amp;gt;, rapidjson::MemoryPoolAllocator&amp;lt;rapidjson::CrtAllocator&amp;gt; &amp;gt; &amp;gt; (this=0x7fffffffcbe8,&lt;BR /&gt;stream=..., handler=...) at /home/jjekeli/workspace/com.src.ewir.keystonert_xeonphi/src/rapidjson/reader.h:636&lt;BR /&gt;636&amp;nbsp;d *= internal::Pow10(exp + expFrac);&lt;BR /&gt;(gdb) print d&lt;/P&gt;
&lt;P&gt;$1 = 45,000&lt;/P&gt;
&lt;P&gt;(gdb) next&lt;BR /&gt;637&amp;nbsp;handler.Double(minus ? -d : d);&lt;BR /&gt;(gdb) print d&lt;BR /&gt;$2 = 4500&lt;BR /&gt;(gdb) print /a d&lt;BR /&gt;$3 = 0x1194&lt;BR /&gt;(gdb) print minus&lt;/P&gt;
&lt;P&gt;$4 = false&lt;BR /&gt;(gdb) step&lt;BR /&gt;0x000000000044e7e4 in rapidjson::GenericDocument&amp;lt;rapidjson::UTF8&amp;lt;char&amp;gt;, rapidjson::MemoryPoolAllocator&amp;lt;rapidjson::CrtAllocator&amp;gt; &amp;gt;::Double (this=0x83df98,&lt;BR /&gt;d=4.2699109613558058e-317) at /home/jjekeli/workspace/com.src.ewir.keystonert_xeonphi/src/rapidjson/document.h:776&lt;BR /&gt;776 void Double(double d) { new (stack_.template Push&amp;lt;ValueType&amp;gt;()) ValueType(d); }&lt;BR /&gt;(gdb) print d&lt;BR /&gt;$4 = 4.2699109613558058e-317&lt;BR /&gt;(gdb) print /a d&lt;BR /&gt;$5 = 0x0&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;As you cane see, before passing into the Double function, d has a valid value and a valid memory address, but upon entering the Double function, it no longer has a valid memory address or a valid value, and causes a seg fault.&lt;/P&gt;
&lt;P&gt;Any thoughts as to why this may be occurring?&lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2013 19:40:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/double-parameter-not-copying-correctly/m-p/939896#M16859</guid>
      <dc:creator>Jonathan_J_</dc:creator>
      <dc:date>2013-07-02T19:40:41Z</dc:date>
    </item>
    <item>
      <title>Could you print out the</title>
      <link>https://community.intel.com/t5/Software-Archive/double-parameter-not-copying-correctly/m-p/939897#M16860</link>
      <description>&lt;P&gt;Could you print out the assembly code for the function call and entry point and send them for us? In addition, you might want to try compiling with a lower optimization level to see if the code works in that case.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Jul 2013 19:18:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/double-parameter-not-copying-correctly/m-p/939897#M16860</guid>
      <dc:creator>Frances_R_Intel</dc:creator>
      <dc:date>2013-07-08T19:18:01Z</dc:date>
    </item>
    <item>
      <title>How can i determine the</title>
      <link>https://community.intel.com/t5/Software-Archive/double-parameter-not-copying-correctly/m-p/939898#M16861</link>
      <description>&lt;P&gt;How can i determine the assembly code for the function call and entry point? Also, we had already tried setting to the lowest optimization level with no luck.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2013 11:51:15 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/double-parameter-not-copying-correctly/m-p/939898#M16861</guid>
      <dc:creator>Jonathan_J_</dc:creator>
      <dc:date>2013-07-09T11:51:15Z</dc:date>
    </item>
    <item>
      <title>A long shot, but have you</title>
      <link>https://community.intel.com/t5/Software-Archive/double-parameter-not-copying-correctly/m-p/939899#M16862</link>
      <description>&lt;P&gt;A long shot, but have you checked that you have enough stack space allocated?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The values I see on the card are&lt;/P&gt;
&lt;P&gt;% ulimit -a&lt;BR /&gt;-f: file size (blocks) unlimited&lt;BR /&gt;-t: cpu time (seconds) unlimited&lt;BR /&gt;-d: data seg size (kb) unlimited&lt;BR /&gt;-s: stack size (kb) 8192&lt;BR /&gt;-c: core file size (blocks) 0&lt;BR /&gt;-m: resident set size (kb) unlimited&lt;BR /&gt;-l: locked memory (kb) 64&lt;BR /&gt;-p: processes 61357&lt;BR /&gt;-n: file descriptors 10240&lt;BR /&gt;-v: address space (kb) unlimited&lt;BR /&gt;-w: locks unlimited&lt;/P&gt;
&lt;P&gt;It might be worth trying with ulimit -s unlimited&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2013 12:00:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/double-parameter-not-copying-correctly/m-p/939899#M16862</guid>
      <dc:creator>James_C_Intel2</dc:creator>
      <dc:date>2013-07-09T12:00:26Z</dc:date>
    </item>
    <item>
      <title>Somewhat worried about</title>
      <link>https://community.intel.com/t5/Software-Archive/double-parameter-not-copying-correctly/m-p/939900#M16863</link>
      <description>&lt;P&gt;Somewhat worried about setting the stack size to unlimited... isn't that a good way to smash one's stack and destroy the kernel?&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2013 12:45:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/double-parameter-not-copying-correctly/m-p/939900#M16863</guid>
      <dc:creator>Jonathan_J_</dc:creator>
      <dc:date>2013-07-09T12:45:12Z</dc:date>
    </item>
    <item>
      <title>Nothing you do with the stack</title>
      <link>https://community.intel.com/t5/Software-Archive/double-parameter-not-copying-correctly/m-p/939901#M16864</link>
      <description>&lt;P&gt;Nothing you do with the stack should be able to cause the kernel to crash.&lt;/P&gt;
&lt;P&gt;However if you are paranoid, &amp;nbsp;by all means just double the size and see if that affects what happens; if it does, that's a strong signal that the amount of stack space may be the problem. (You may need to change the pthread stack size, rather than just using ulimit, of course, if your code is threaded).&lt;/P&gt;
&lt;P&gt;You should also be able to work out how much stack you're using from the debugger. Look at the value of %rsp at the point of the crash, and then go back to the top of the thread's stack and look at the address of a local variable there. The difference is (close to) the stack usage. If it's nearly the stack limit that's a strong hint.&lt;/P&gt;
&lt;P&gt;Also, if %rsp at the point of the crash is just below a page boundary, that's suspicious. If you then look at /proc/&lt;EM&gt;pid&lt;/EM&gt;/maps for the process you shouldbe able to see if %rsp is pointing at valid memory or not.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2013 13:14:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/double-parameter-not-copying-correctly/m-p/939901#M16864</guid>
      <dc:creator>James_C_Intel2</dc:creator>
      <dc:date>2013-07-09T13:14:52Z</dc:date>
    </item>
    <item>
      <title>Setting the stack size to</title>
      <link>https://community.intel.com/t5/Software-Archive/double-parameter-not-copying-correctly/m-p/939902#M16865</link>
      <description>&lt;P&gt;Setting the stack size to unlimited did not alleviate the problem. Sorry.&lt;/P&gt;
&lt;P&gt;The stack pointer at the beginning of the thread was&amp;nbsp;&amp;nbsp;0x7fffffffe100. &amp;nbsp;At the point of the crash, the stack pointer was at&amp;nbsp;&amp;nbsp;0x7fffffffc2f0, a difference of&amp;nbsp;7696. &amp;nbsp;That is near-ish the original stack size, but setting ulimit -s unlimited did not help. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;Wasn't able to access the maps through proc/pid/maps? The pid was 7497, but there was no 7497 directory?&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2013 14:05:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/double-parameter-not-copying-correctly/m-p/939902#M16865</guid>
      <dc:creator>Jonathan_J_</dc:creator>
      <dc:date>2013-07-09T14:05:23Z</dc:date>
    </item>
    <item>
      <title>It doesn't seem like it is</title>
      <link>https://community.intel.com/t5/Software-Archive/double-parameter-not-copying-correctly/m-p/939903#M16866</link>
      <description>&lt;P&gt;It doesn't seem like it is the stack, then, since the limit is in KB, not bytes, so you seem to be a long way away from the limit.&lt;/P&gt;
&lt;P&gt;I'll crawl back under my stone :-)&lt;/P&gt;</description>
      <pubDate>Tue, 09 Jul 2013 14:29:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/double-parameter-not-copying-correctly/m-p/939903#M16866</guid>
      <dc:creator>James_C_Intel2</dc:creator>
      <dc:date>2013-07-09T14:29:52Z</dc:date>
    </item>
  </channel>
</rss>

