<?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;Dynamic allocation&amp;quot; and &amp;quot;modules&amp;quot;: Is this a bug or a functionnality? in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/quot-Dynamic-allocation-quot-and-quot-modules-quot-Is-this-a-bug/m-p/778538#M26352</link>
    <description>Dear Intel Fortran forum,&lt;BR /&gt;&lt;BR /&gt;I have discovered the following behaviour which can be reproduced with the code attached to this thread.&lt;BR /&gt;&lt;BR /&gt;I have lots of big old programs which uses large amount of static data (and since its windows i am limited to 2GB, even in 64 bits compilation).&lt;BR /&gt;&lt;BR /&gt;I want to do minimal changes to use allocatable arrays.&lt;BR /&gt;&lt;BR /&gt;I have created the following code and i am very suprised that it works:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;[fxfortran]      PROGRAM Dynamic_module_example      
               
        IMPLICIT NONE
 
        CALL DYNAMIC_ALLOCATION
        CALL SUBROUTINE1
        CALL SUBROUTINE2
        
        PAUSE
                       
     END PROGRAM Dynamic_module_example[/fxfortran]&lt;/PRE&gt;&lt;BR /&gt;&lt;PRE&gt;[fxfortran]     MODULE arrays
        REAL, ALLOCATABLE :: A(:),B(:),C(:)
     END MODULE[/fxfortran]&lt;/PRE&gt;&lt;PRE&gt;[fxfortran]     SUBROUTINE DYNAMIC_ALLOCATION()

     USE arrays
     
     INTEGER*4 I
     
     ALLOCATE (A(1000000),B(1000000),C(1000000))
     
     RETURN
     END SUBROUTINE[/fxfortran]&lt;/PRE&gt;&lt;PRE&gt;[fxfortran]    SUBROUTINE SUBROUTINE1()

     USE arrays
     
     INTEGER*4 I
     
     DO I=1,10000
        A(I)=SIN(I*1.0)
        B(I)=COS(I*1.0)
        C(I)=TAN(I*1.0)
     END DO
     RETURN
     END SUBROUTINE[/fxfortran]&lt;/PRE&gt;&lt;PRE&gt;[bash]   SUBROUTINE SUBROUTINE2()

     CALL SUBROUTINE3

     RETURN
     END SUBROUTINE[/bash]&lt;/PRE&gt;&amp;lt;&lt;PRE&gt;[bash]     SUBROUTINE SUBROUTINE3()

     USE arrays
     
     INTEGER*4 I
     
     DO I=1,100
        PRINT '(3F12.5)',A(I),B(I),C(I)
     END DO

     RETURN
     END SUBROUTINE[/bash]&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;&lt;/PRE&gt;Please note that i have read the documentation and haven't found a clear explanation about it.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;In fact, i use the MODULE as a COMMON for dynamic variables and i wonder why my variables are correctly maintained in memory.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Is this dangerous, is this a normal behaviour ?Thank you.F.X&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Wed, 24 Nov 2010 09:01:25 GMT</pubDate>
    <dc:creator>François-Xavier</dc:creator>
    <dc:date>2010-11-24T09:01:25Z</dc:date>
    <item>
      <title>"Dynamic allocation" and "modules": Is this a bug or a functionnality?</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/quot-Dynamic-allocation-quot-and-quot-modules-quot-Is-this-a-bug/m-p/778538#M26352</link>
      <description>Dear Intel Fortran forum,&lt;BR /&gt;&lt;BR /&gt;I have discovered the following behaviour which can be reproduced with the code attached to this thread.&lt;BR /&gt;&lt;BR /&gt;I have lots of big old programs which uses large amount of static data (and since its windows i am limited to 2GB, even in 64 bits compilation).&lt;BR /&gt;&lt;BR /&gt;I want to do minimal changes to use allocatable arrays.&lt;BR /&gt;&lt;BR /&gt;I have created the following code and i am very suprised that it works:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;[fxfortran]      PROGRAM Dynamic_module_example      
               
        IMPLICIT NONE
 
        CALL DYNAMIC_ALLOCATION
        CALL SUBROUTINE1
        CALL SUBROUTINE2
        
        PAUSE
                       
     END PROGRAM Dynamic_module_example[/fxfortran]&lt;/PRE&gt;&lt;BR /&gt;&lt;PRE&gt;[fxfortran]     MODULE arrays
        REAL, ALLOCATABLE :: A(:),B(:),C(:)
     END MODULE[/fxfortran]&lt;/PRE&gt;&lt;PRE&gt;[fxfortran]     SUBROUTINE DYNAMIC_ALLOCATION()

     USE arrays
     
     INTEGER*4 I
     
     ALLOCATE (A(1000000),B(1000000),C(1000000))
     
     RETURN
     END SUBROUTINE[/fxfortran]&lt;/PRE&gt;&lt;PRE&gt;[fxfortran]    SUBROUTINE SUBROUTINE1()

     USE arrays
     
     INTEGER*4 I
     
     DO I=1,10000
        A(I)=SIN(I*1.0)
        B(I)=COS(I*1.0)
        C(I)=TAN(I*1.0)
     END DO
     RETURN
     END SUBROUTINE[/fxfortran]&lt;/PRE&gt;&lt;PRE&gt;[bash]   SUBROUTINE SUBROUTINE2()

     CALL SUBROUTINE3

     RETURN
     END SUBROUTINE[/bash]&lt;/PRE&gt;&amp;lt;&lt;PRE&gt;[bash]     SUBROUTINE SUBROUTINE3()

     USE arrays
     
     INTEGER*4 I
     
     DO I=1,100
        PRINT '(3F12.5)',A(I),B(I),C(I)
     END DO

     RETURN
     END SUBROUTINE[/bash]&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;&lt;/PRE&gt;Please note that i have read the documentation and haven't found a clear explanation about it.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;In fact, i use the MODULE as a COMMON for dynamic variables and i wonder why my variables are correctly maintained in memory.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Is this dangerous, is this a normal behaviour ?Thank you.F.X&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Wed, 24 Nov 2010 09:01:25 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/quot-Dynamic-allocation-quot-and-quot-modules-quot-Is-this-a-bug/m-p/778538#M26352</guid>
      <dc:creator>François-Xavier</dc:creator>
      <dc:date>2010-11-24T09:01:25Z</dc:date>
    </item>
    <item>
      <title>"Dynamic allocation" and "modules": Is this a bug or a function</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/quot-Dynamic-allocation-quot-and-quot-modules-quot-Is-this-a-bug/m-p/778539#M26353</link>
      <description>If you had used the save attribute for the module variables your code should work. But without save it is not required to work. I dont think the compiler is required to deallocate module variables that go out of scope. Perhaps others can confirm.</description>
      <pubDate>Wed, 24 Nov 2010 11:20:57 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/quot-Dynamic-allocation-quot-and-quot-modules-quot-Is-this-a-bug/m-p/778539#M26353</guid>
      <dc:creator>Andrew_Smith</dc:creator>
      <dc:date>2010-11-24T11:20:57Z</dc:date>
    </item>
    <item>
      <title>"Dynamic allocation" and "modules": Is this a bug or a function</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/quot-Dynamic-allocation-quot-and-quot-modules-quot-Is-this-a-bug/m-p/778540#M26354</link>
      <description>Hello Andrew,&lt;BR /&gt;&lt;BR /&gt;Thank you for your reply.&lt;BR /&gt;&lt;BR /&gt;i didn't use the "SAVE" attribute, i just used the default compiler option (which does not USE SAVE if my memory serves me right)&lt;BR /&gt;</description>
      <pubDate>Wed, 24 Nov 2010 12:05:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/quot-Dynamic-allocation-quot-and-quot-modules-quot-Is-this-a-bug/m-p/778540#M26354</guid>
      <dc:creator>François-Xavier</dc:creator>
      <dc:date>2010-11-24T12:05:00Z</dc:date>
    </item>
    <item>
      <title>"Dynamic allocation" and "modules": Is this a bug or a function</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/quot-Dynamic-allocation-quot-and-quot-modules-quot-Is-this-a-bug/m-p/778541#M26355</link>
      <description>&lt;DIV id="tiny_quote"&gt;
                &lt;DIV style="margin-left: 2px; margin-right: 2px;"&gt;Quoting &lt;A rel="/en-us/services/profile/quick_profile.php?is_paid=&amp;amp;user_id=99034" class="basic" href="https://community.intel.com/en-us/profile/99034/"&gt;Andrew Smith&lt;/A&gt;&lt;/DIV&gt;
                &lt;DIV style="background-color: #e5e5e5; padding: 5px; border: 1px inset; margin-left: 2px; margin-right: 2px;"&gt;&lt;I&gt;If you had used the save attribute for the module variables your code should work. But without save it is not required to work. I dont think the compiler is required to deallocate module variables that go out of scope. Perhaps others can confirm.&lt;/I&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Theoretically true, but only of academic interest. For all intents and purposes, module variables on modern compilers never go out of scope. Thus, SAVE attribute is required only for standard-compliance (you will get a warning if you turn on standard checking), but not really necessary.&lt;/P&gt;</description>
      <pubDate>Wed, 24 Nov 2010 12:26:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/quot-Dynamic-allocation-quot-and-quot-modules-quot-Is-this-a-bug/m-p/778541#M26355</guid>
      <dc:creator>Jugoslav_Dujic</dc:creator>
      <dc:date>2010-11-24T12:26:52Z</dc:date>
    </item>
    <item>
      <title>"Dynamic allocation" and "modules": Is this a bug or a function</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/quot-Dynamic-allocation-quot-and-quot-modules-quot-Is-this-a-bug/m-p/778542#M26356</link>
      <description>&lt;DIV id="tiny_quote"&gt;&lt;DIV style="margin-left: 2px; margin-right: 2px;"&gt;Quoting &lt;A jquery1290602346960="64" rel="/en-us/services/profile/quick_profile.php?is_paid=&amp;amp;user_id=391180" href="https://community.intel.com/en-us/profile/391180/" class="basic"&gt;Jugoslav Dujic&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;&lt;DIV id="tiny_quote"&gt;&lt;DIV style="margin-left: 2px; margin-right: 2px;"&gt;Quoting &lt;A jquery1290602346960="65" rel="/en-us/services/profile/quick_profile.php?is_paid=&amp;amp;user_id=99034" href="https://community.intel.com/en-us/profile/99034/" class="basic"&gt;Andrew Smith&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;If you had used the save attribute for the module variables your code should work. But without save it is not required to work. I dont think the compiler is required to deallocate module variables that go out of scope. Perhaps others can confirm.&lt;/I&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Theoretically true, but only of academic interest. For all intents and purposes, module variables on modern compilers never go out of scope. Thus, SAVE attribute is required only for standard-compliance (you will get a warning if you turn on standard checking), but not really necessary.&lt;/P&gt;&lt;/I&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;Thank you for your response.&lt;BR /&gt;&lt;BR /&gt;To be clear, what conclusion can i understand? Is my testcase a dangerous way to use module variables?&lt;BR /&gt;&lt;BR /&gt;Thank you,&lt;BR /&gt;&lt;BR /&gt;F-Xavier&lt;/P&gt;</description>
      <pubDate>Wed, 24 Nov 2010 12:40:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/quot-Dynamic-allocation-quot-and-quot-modules-quot-Is-this-a-bug/m-p/778542#M26356</guid>
      <dc:creator>François-Xavier</dc:creator>
      <dc:date>2010-11-24T12:40:19Z</dc:date>
    </item>
    <item>
      <title>"Dynamic allocation" and "modules": Is this a bug or a function</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/quot-Dynamic-allocation-quot-and-quot-modules-quot-Is-this-a-bug/m-p/778543#M26357</link>
      <description>&lt;DIV id="tiny_quote"&gt;&lt;DIV style="margin-left: 2px; margin-right: 2px;"&gt;Quoting &lt;A jquery1290604344526="65" rel="/en-us/services/profile/quick_profile.php?is_paid=&amp;amp;user_id=407513" href="https://community.intel.com/en-us/profile/407513/" class="basic"&gt;Franois-Xavier&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;&lt;DIV id="tiny_quote"&gt;&lt;DIV style="margin-left: 2px; margin-right: 2px;"&gt;To be clear, what conclusion can i understand? Is my testcase a dangerous way to use module variables?&lt;/DIV&gt;&lt;/DIV&gt;&lt;/I&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;BR /&gt;In practice - no&lt;BR /&gt;It is theoretically possible that therecould be a compiler/processer/OS combination that will cause this sort of code to fail because themodule hasgone out of scope. But the de facto situation at the moment is that this will "just work"&lt;BR /&gt;&lt;BR /&gt;Les&lt;/P&gt;</description>
      <pubDate>Wed, 24 Nov 2010 13:00:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/quot-Dynamic-allocation-quot-and-quot-modules-quot-Is-this-a-bug/m-p/778543#M26357</guid>
      <dc:creator>Les_Neilson</dc:creator>
      <dc:date>2010-11-24T13:00:58Z</dc:date>
    </item>
    <item>
      <title>"Dynamic allocation" and "modules": Is this a bug or a function</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/quot-Dynamic-allocation-quot-and-quot-modules-quot-Is-this-a-bug/m-p/778544#M26358</link>
      <description>Module variables are implicitly SAVEd. Earlier versions of the Fortran standard did not specify this, though I know of no compiler which would behave otherwise. Fortran 2008 now specifies the implied SAVE which everyone applied anyway.</description>
      <pubDate>Wed, 24 Nov 2010 14:10:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/quot-Dynamic-allocation-quot-and-quot-modules-quot-Is-this-a-bug/m-p/778544#M26358</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2010-11-24T14:10:18Z</dc:date>
    </item>
    <item>
      <title>"Dynamic allocation" and "modules": Is this a bug or a function</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/quot-Dynamic-allocation-quot-and-quot-modules-quot-Is-this-a-bug/m-p/778545#M26359</link>
      <description>&lt;P&gt;Thank you Steve,&lt;BR /&gt;&lt;BR /&gt;It would be very nice to be clearly explained in MODULE documentation.&lt;BR /&gt;&lt;BR /&gt;F-Xavier&lt;/P&gt;</description>
      <pubDate>Wed, 24 Nov 2010 14:35:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/quot-Dynamic-allocation-quot-and-quot-modules-quot-Is-this-a-bug/m-p/778545#M26359</guid>
      <dc:creator>François-Xavier</dc:creator>
      <dc:date>2010-11-24T14:35:52Z</dc:date>
    </item>
  </channel>
</rss>

