<?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: Error using malloc to allocate memory in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-using-malloc-to-allocate-memory/m-p/740570#M429</link>
    <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;BR /&gt;You would have to build with the 32-bit compiler, which is likely to require that you install additional 32-bit development components as specified in the Intel Fortran release notes.&lt;BR /&gt;</description>
    <pubDate>Tue, 03 Nov 2009 17:05:20 GMT</pubDate>
    <dc:creator>Steven_L_Intel1</dc:creator>
    <dc:date>2009-11-03T17:05:20Z</dc:date>
    <item>
      <title>Error using malloc to allocate memory</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-using-malloc-to-allocate-memory/m-p/740561#M420</link>
      <description>I am using ifort to compile my Fortran source codes. There is a problem when running the one of the functions to allocate memories. The function 'rmalloc' returns an negative value, which is not correct, once the 'size' parameters is larger than 70000. There is no such error when the 'size' parameter less than 2260. Any suggestion is appreciated.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;function rmalloc (size,at,total)&lt;BR /&gt;integer size,amount,idx,rmalloc,total&lt;BR /&gt;integer(C_INTPTR_T) ptr, block&lt;BR /&gt;dimension at(*)&lt;BR /&gt;pointer (ptr,a(1)),(block,b(1))&lt;BR /&gt;ptr = %loc(at)&lt;BR /&gt;amount = 4*size + 8&lt;BR /&gt;block = malloc(amount)&lt;BR /&gt;do i=1,size+1&lt;BR /&gt;b(i) = 0&lt;BR /&gt;enddo&lt;BR /&gt;rmalloc = (block - ptr)/4 + 1&lt;BR /&gt;total = total + amount/4&lt;BR /&gt;return&lt;BR /&gt;end&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 28 Oct 2009 15:57:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-using-malloc-to-allocate-memory/m-p/740561#M420</guid>
      <dc:creator>kai_long_mi</dc:creator>
      <dc:date>2009-10-28T15:57:34Z</dc:date>
    </item>
    <item>
      <title>Re: Error using malloc</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-using-malloc-to-allocate-memory/m-p/740562#M421</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;BR /&gt;Are you using a 64-bit compiler? If so, your use of "integer" for block, etc. is wrong. I suggest declaring address-sized integers as:&lt;BR /&gt;&lt;BR /&gt;integer(C_INTPTR_T)&lt;BR /&gt;&lt;BR /&gt;where C_INTPTR_T is defined in intrinsic module ISO_C_BINDING.&lt;BR /&gt;</description>
      <pubDate>Wed, 28 Oct 2009 16:01:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-using-malloc-to-allocate-memory/m-p/740562#M421</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2009-10-28T16:01:13Z</dc:date>
    </item>
    <item>
      <title>Re: Error using malloc</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-using-malloc-to-allocate-memory/m-p/740563#M422</link>
      <description>&lt;DIV style="margin: 0px; height: auto;"&gt;&lt;/DIV&gt;
&lt;P&gt;Yes. I am compiling the codes on the 64-bit system.The segment error happens when the 'size' parameter equals 70000, there is no such error when the 'size' parameter less than 2260.When I modify the 'ptr' and 'block' to use 'integer(C_INTPTR_T) ptr, block'. There is a compiling error like 'error #6683: A kind type parameter must be a compile-time constant. [C_INTPTR_T]'. I simplified the function like below.&lt;BR /&gt;&lt;BR /&gt;function rmalloc (size,at,total)&lt;BR /&gt;integer size,amount,idx,rmalloc,total&lt;BR /&gt;integer(C_INTPTR_T) ptr, block&lt;BR /&gt;dimension at(*)&lt;BR /&gt;pointer (ptr,a(1)),(block,b(1))&lt;BR /&gt;ptr = %loc(at)&lt;BR /&gt;amount = 4*size + 8&lt;BR /&gt;block = malloc(amount)&lt;BR /&gt;do i=1,size+1&lt;BR /&gt;b(i) = 0&lt;BR /&gt;enddo&lt;BR /&gt;rmalloc = (block - ptr)/4 + 1&lt;BR /&gt;total = total + amount/4&lt;BR /&gt;return&lt;BR /&gt;end&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2009 19:01:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-using-malloc-to-allocate-memory/m-p/740563#M422</guid>
      <dc:creator>kai_long_mi</dc:creator>
      <dc:date>2009-10-29T19:01:26Z</dc:date>
    </item>
    <item>
      <title>Re: Error using malloc to allocate memory</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-using-malloc-to-allocate-memory/m-p/740564#M423</link>
      <description>&lt;DIV style="margin: 0px; height: auto;"&gt;&lt;/DIV&gt;
&lt;BR /&gt;Add:&lt;BR /&gt;&lt;BR /&gt;use, intrinsic :: iso_c_binding&lt;BR /&gt;&lt;BR /&gt;just after the "function" statement.&lt;BR /&gt;&lt;BR /&gt;Did you edit the code in your initial post?&lt;BR /&gt;</description>
      <pubDate>Thu, 29 Oct 2009 23:20:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-using-malloc-to-allocate-memory/m-p/740564#M423</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2009-10-29T23:20:23Z</dc:date>
    </item>
    <item>
      <title>Re: Error using malloc to allocate memory</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-using-malloc-to-allocate-memory/m-p/740565#M424</link>
      <description>&lt;DIV style="margin:0px;"&gt;Thank you, Steve. Yes, I simplified the intial post for easier to view. I tried adding intrinsic :: iso_c_binding rightbehind the 'function rmalloc (size,at,total)'. There is a compiling error says 'error #6407 This symbolic name is not an intrinsic function name or an intrinsic subroutine name [ISO_C_BINDING]'&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;
&lt;DIV id="quote_reply" style="margin-top: 5px; width: 100%;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/336209"&gt;Steve Lionel (Intel)&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;&lt;BR /&gt;Add:&lt;BR /&gt;&lt;BR /&gt;use, intrinsic :: iso_c_binding&lt;BR /&gt;&lt;BR /&gt;just after the "function" statement.&lt;BR /&gt;&lt;BR /&gt;Did you edit the code in your initial post?&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;</description>
      <pubDate>Fri, 30 Oct 2009 13:35:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-using-malloc-to-allocate-memory/m-p/740565#M424</guid>
      <dc:creator>kai_long_mi</dc:creator>
      <dc:date>2009-10-30T13:35:04Z</dc:date>
    </item>
    <item>
      <title>Re: Error using malloc to allocate memory</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-using-malloc-to-allocate-memory/m-p/740566#M425</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;BR /&gt;You forgot the keyword "use".&lt;BR /&gt;&lt;BR /&gt;use, intrinsic :: iso_c_binding&lt;BR /&gt;</description>
      <pubDate>Fri, 30 Oct 2009 14:58:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-using-malloc-to-allocate-memory/m-p/740566#M425</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2009-10-30T14:58:46Z</dc:date>
    </item>
    <item>
      <title>Re: Error using malloc to allocate memory</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-using-malloc-to-allocate-memory/m-p/740567#M426</link>
      <description>&lt;DIV style="margin:0px;"&gt;Yes. You are right. I forgot the 'use'. Since this function is used by other main programs. Should I also define integer(C_INTPTR_T) for the variables which uses this function? Is this (C_INTPTR_T) same as I define integer *8 ptr, block for the 64-bit system? Thank you.&lt;/DIV&gt;
&lt;BR /&gt;</description>
      <pubDate>Fri, 30 Oct 2009 15:55:59 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-using-malloc-to-allocate-memory/m-p/740567#M426</guid>
      <dc:creator>kai_long_mi</dc:creator>
      <dc:date>2009-10-30T15:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: Error using malloc to allocate memory</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-using-malloc-to-allocate-memory/m-p/740568#M427</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;BR /&gt;You should use this to declare any address-sized integer variables. It will select the proper size for 32-bit or 64-bit compilations.&lt;BR /&gt;&lt;BR /&gt;However, if you name the variable as the pointer in an "integer POINTER" statement, as is shown currently in your source, you can skip declaring it entirely and the compiler will declare it to the correct size.&lt;BR /&gt;</description>
      <pubDate>Fri, 30 Oct 2009 16:01:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-using-malloc-to-allocate-memory/m-p/740568#M427</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2009-10-30T16:01:05Z</dc:date>
    </item>
    <item>
      <title>Re: Error using malloc to allocate memory</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-using-malloc-to-allocate-memory/m-p/740569#M428</link>
      <description>&lt;DIV style="margin:0px;"&gt;Thank you Steve. I tried this method. There are too many variables in the source codes. The major problem is that the source code is written in 32-bit, while our computing system is 64-bit now. Is there any method could run 32-bit code on 64-bit system without changing the source code. &lt;BR /&gt;
&lt;DIV id="quote_reply" style="margin-top: 5px; width: 100%;"&gt;
&lt;DIV style="margin-left:2px;margin-right:2px;"&gt;Quoting - &lt;A href="https://community.intel.com/en-us/profile/336209"&gt;Steve Lionel (Intel)&lt;/A&gt;&lt;/DIV&gt;
&lt;DIV style="background-color:#E5E5E5; padding:5px;border: 1px; border-style: inset;margin-left:2px;margin-right:2px;"&gt;&lt;EM&gt;&lt;BR /&gt;You should use this to declare any address-sized integer variables. It will select the proper size for 32-bit or 64-bit compilations.&lt;BR /&gt;&lt;BR /&gt;However, if you name the variable as the pointer in an "integer POINTER" statement, as is shown currently in your source, you can skip declaring it entirely and the compiler will declare it to the correct size.&lt;BR /&gt;&lt;/EM&gt;&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;BR /&gt;</description>
      <pubDate>Tue, 03 Nov 2009 15:40:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-using-malloc-to-allocate-memory/m-p/740569#M428</guid>
      <dc:creator>kai_long_mi</dc:creator>
      <dc:date>2009-11-03T15:40:51Z</dc:date>
    </item>
    <item>
      <title>Re: Error using malloc to allocate memory</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-using-malloc-to-allocate-memory/m-p/740570#M429</link>
      <description>&lt;DIV style="margin:0px;"&gt;&lt;/DIV&gt;
&lt;BR /&gt;You would have to build with the 32-bit compiler, which is likely to require that you install additional 32-bit development components as specified in the Intel Fortran release notes.&lt;BR /&gt;</description>
      <pubDate>Tue, 03 Nov 2009 17:05:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Error-using-malloc-to-allocate-memory/m-p/740570#M429</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2009-11-03T17:05:20Z</dc:date>
    </item>
  </channel>
</rss>

