<?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 Re: Lost Memory in Software Archive</title>
    <link>https://community.intel.com/t5/Software-Archive/Lost-Memory/m-p/988220#M27681</link>
    <description>Yes, that could cause various nasty behaviours. I feel inclined to write a debugging anecdote of mine. First, I spotted that the program does something wrong in routine called Validate:&lt;BR /&gt; &lt;BR /&gt;&lt;CODE&gt;integer function Validate(iValid)&lt;/CODE&gt;&lt;BR /&gt; &lt;BR /&gt;which was called as:&lt;BR /&gt; &lt;BR /&gt;&lt;CODE&gt;j = Validate(VALID_TOPOLOGY)&lt;/CODE&gt;&lt;BR /&gt; &lt;BR /&gt;The argument is declared as:&lt;BR /&gt; &lt;BR /&gt;&lt;CODE&gt;integer, parameter:: VALID_TOPOLOGY       = 1&lt;/CODE&gt;&lt;BR /&gt; &lt;BR /&gt;When I inspected value of iValid argument in the debugger, it was 47, which was meaningless. Hmmm, strange. I had to insert a "sanity check" line immediately before the call:&lt;BR /&gt; &lt;BR /&gt;&lt;CODE&gt;idummy = VALID_TOPOLOGY&lt;/CODE&gt;&lt;BR /&gt; &lt;BR /&gt;I rebuilt the application, and checked value of idummy in the debugger. It was 1 as expected. However, value of iValid was still 47. Have you seen "A Beautiful Mind?" :-)&lt;BR /&gt; &lt;BR /&gt;&lt;I&gt;(...an hour later)&lt;/I&gt;&lt;BR /&gt; &lt;BR /&gt;The source of the problem lied in the call few dozen lines before the crazy one. Another routine was called like&lt;BR /&gt; &lt;BR /&gt;&lt;CODE&gt;call e_sin_ostrva(ierror,1)&lt;/CODE&gt;&lt;BR /&gt; &lt;BR /&gt;It actually changed the value of constant "1" to 47. Compiler saw that the constant with value 1 was used twice as argument in the same routine (once as literal, once as PARAMETER), so it decided to reuse the same memory location, thus VALID_TOPOLOGY become 47. But then, how didn't it show in my "sanity check" line? Simply, compiler saw that I'm assigning a constant to a variable so it didn't bother to actually do the copying from one memory location to another; instead, it just translated the line as j=1. &lt;BR /&gt; &lt;BR /&gt;Jugoslav</description>
    <pubDate>Mon, 22 Apr 2002 17:47:41 GMT</pubDate>
    <dc:creator>Jugoslav_Dujic</dc:creator>
    <dc:date>2002-04-22T17:47:41Z</dc:date>
    <item>
      <title>Lost Memory</title>
      <link>https://community.intel.com/t5/Software-Archive/Lost-Memory/m-p/988218#M27679</link>
      <description>What's wrong if a declared constant can't hold its value (i.e. it changes to zero after some times) throughout the program execution? .</description>
      <pubDate>Sat, 20 Apr 2002 19:00:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Lost-Memory/m-p/988218#M27679</guid>
      <dc:creator>elf</dc:creator>
      <dc:date>2002-04-20T19:00:51Z</dc:date>
    </item>
    <item>
      <title>Re: Lost Memory</title>
      <link>https://community.intel.com/t5/Software-Archive/Lost-Memory/m-p/988219#M27680</link>
      <description>You have Windows 9X, passed the constant as an argument to a routine and that routine changed the value of the argument.&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Sat, 20 Apr 2002 21:40:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Lost-Memory/m-p/988219#M27680</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2002-04-20T21:40:52Z</dc:date>
    </item>
    <item>
      <title>Re: Lost Memory</title>
      <link>https://community.intel.com/t5/Software-Archive/Lost-Memory/m-p/988220#M27681</link>
      <description>Yes, that could cause various nasty behaviours. I feel inclined to write a debugging anecdote of mine. First, I spotted that the program does something wrong in routine called Validate:&lt;BR /&gt; &lt;BR /&gt;&lt;CODE&gt;integer function Validate(iValid)&lt;/CODE&gt;&lt;BR /&gt; &lt;BR /&gt;which was called as:&lt;BR /&gt; &lt;BR /&gt;&lt;CODE&gt;j = Validate(VALID_TOPOLOGY)&lt;/CODE&gt;&lt;BR /&gt; &lt;BR /&gt;The argument is declared as:&lt;BR /&gt; &lt;BR /&gt;&lt;CODE&gt;integer, parameter:: VALID_TOPOLOGY       = 1&lt;/CODE&gt;&lt;BR /&gt; &lt;BR /&gt;When I inspected value of iValid argument in the debugger, it was 47, which was meaningless. Hmmm, strange. I had to insert a "sanity check" line immediately before the call:&lt;BR /&gt; &lt;BR /&gt;&lt;CODE&gt;idummy = VALID_TOPOLOGY&lt;/CODE&gt;&lt;BR /&gt; &lt;BR /&gt;I rebuilt the application, and checked value of idummy in the debugger. It was 1 as expected. However, value of iValid was still 47. Have you seen "A Beautiful Mind?" :-)&lt;BR /&gt; &lt;BR /&gt;&lt;I&gt;(...an hour later)&lt;/I&gt;&lt;BR /&gt; &lt;BR /&gt;The source of the problem lied in the call few dozen lines before the crazy one. Another routine was called like&lt;BR /&gt; &lt;BR /&gt;&lt;CODE&gt;call e_sin_ostrva(ierror,1)&lt;/CODE&gt;&lt;BR /&gt; &lt;BR /&gt;It actually changed the value of constant "1" to 47. Compiler saw that the constant with value 1 was used twice as argument in the same routine (once as literal, once as PARAMETER), so it decided to reuse the same memory location, thus VALID_TOPOLOGY become 47. But then, how didn't it show in my "sanity check" line? Simply, compiler saw that I'm assigning a constant to a variable so it didn't bother to actually do the copying from one memory location to another; instead, it just translated the line as j=1. &lt;BR /&gt; &lt;BR /&gt;Jugoslav</description>
      <pubDate>Mon, 22 Apr 2002 17:47:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Lost-Memory/m-p/988220#M27681</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2002-04-22T17:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: Lost Memory</title>
      <link>https://community.intel.com/t5/Software-Archive/Lost-Memory/m-p/988221#M27682</link>
      <description>The reason why Windows 9X is important is that it ignores the compiler's request to make constants read-only.  Windows NT/2000/XP do the right thing.&lt;BR /&gt;&lt;BR /&gt;Steve</description>
      <pubDate>Mon, 22 Apr 2002 22:35:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Software-Archive/Lost-Memory/m-p/988221#M27682</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2002-04-22T22:35:25Z</dc:date>
    </item>
  </channel>
</rss>

