<?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 ifort+openmp evaluates ASSOCIATED on empty pointer to TRUE in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/ifort-openmp-evaluates-ASSOCIATED-on-empty-pointer-to-TRUE/m-p/753856#M9467</link>
    <description>Dear Steve,&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;That's it. Calling ASSOCIATED on undefined pointers has not affected my code until now, so I had a hard time finding out that this was what made my code fail with OpenMP. Sinceit's a bad thing to have in my code anyway, I will fix it now. Thanks a lot for your quick answer.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;</description>
    <pubDate>Fri, 18 Mar 2011 15:44:52 GMT</pubDate>
    <dc:creator>wimr</dc:creator>
    <dc:date>2011-03-18T15:44:52Z</dc:date>
    <item>
      <title>ifort+openmp evaluates ASSOCIATED on empty pointer to TRUE</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/ifort-openmp-evaluates-ASSOCIATED-on-empty-pointer-to-TRUE/m-p/753854#M9465</link>
      <description>Hi,&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;I am experiencing some problems when compiling my code with the -openmp flag, even in parts where there is no OpenMP presents. To illustrate one problem, I wrote the small code below. I'm on Mac OS X 10.6.6 and the problem occurs for me with ifort11.1.067 and also with 12.0.0.085&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;When I compile in debug mode, using ifort -g -FR test.f90, the program performs as expected: the ASSOCIATED(adata) inside the subroutine alloc returns false and so the array is being allocated, and the subroutine returns. When I add the openmp flag (even though there is no openmp code here) to the compilation options, I get the following output:&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV id="_mcePaste"&gt;inside alloc, testing associated&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;Adata associated&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;Size:  1606416640      0&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;Deallocation with status     173&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;Allocation with status      0&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;End program&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;For some reason, the ASSOCIATED returned a TRUE, and the code continues with deallocating the pointer from which it returns an error code.&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;Is there something wrong with the code I wrote in terms of Fortran rules, that only shows up when I compile with -openmp? Or is this a compiler bug? By the way, the problem disappears without the -g flag.&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;Thanks!&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;PRE&gt;[fortran]PROGRAM test

IMPLICIT NONE

INTERFACE alloc
   SUBROUTINE alloc(adata,info)
     IMPLICIT NONE
     INTEGER, DIMENSION(:,:), POINTER :: adata
     INTEGER, INTENT(INOUT)  :: info
   END SUBROUTINE alloc
END INTERFACE alloc

INTEGER, DIMENSION(:,:), POINTER :: Npx
INTEGER  :: info

   CALL alloc(Npx,info)

   DEALLOCATE(Npx)
   WRITE(*,*) 'End program'
END PROGRAM


SUBROUTINE alloc(adata,info)

IMPLICIT NONE

INTEGER, DIMENSION(:,:), POINTER :: adata
INTEGER, INTENT(INOUT)  :: info

   WRITE(*,*) 'inside alloc, testing associated'
   IF(ASSOCIATED(adata)) THEN
      WRITE(*,*) 'Adata associated'
      WRITE(*,*) 'Size: ',Size(adata,1),Size(adata,2)
      DEALLOCATE(adata,STAT=info)
      WRITE(*,*) 'Deallocation with status ',info
      NULLIFY(adata)
   END IF

   ALLOCATE(adata(10,10),STAT=info)
   WRITE(*,*) 'Allocation with status ',info

END SUBROUTINE alloc[/fortran]&lt;/PRE&gt; &lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;&lt;DIV id="_mcePaste"&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 18 Mar 2011 14:26:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/ifort-openmp-evaluates-ASSOCIATED-on-empty-pointer-to-TRUE/m-p/753854#M9465</guid>
      <dc:creator>wimr</dc:creator>
      <dc:date>2011-03-18T14:26:50Z</dc:date>
    </item>
    <item>
      <title>ifort+openmp evaluates ASSOCIATED on empty pointer to TRUE</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/ifort-openmp-evaluates-ASSOCIATED-on-empty-pointer-to-TRUE/m-p/753855#M9466</link>
      <description>The association status of your pointer is "undefined", therefore the result of calling ASSOCIATED is also undefined. If you want Npx to start out as unassociated, add =&amp;gt; NULL() to its declaration.</description>
      <pubDate>Fri, 18 Mar 2011 15:20:47 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/ifort-openmp-evaluates-ASSOCIATED-on-empty-pointer-to-TRUE/m-p/753855#M9466</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2011-03-18T15:20:47Z</dc:date>
    </item>
    <item>
      <title>ifort+openmp evaluates ASSOCIATED on empty pointer to TRUE</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/ifort-openmp-evaluates-ASSOCIATED-on-empty-pointer-to-TRUE/m-p/753856#M9467</link>
      <description>Dear Steve,&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;That's it. Calling ASSOCIATED on undefined pointers has not affected my code until now, so I had a hard time finding out that this was what made my code fail with OpenMP. Sinceit's a bad thing to have in my code anyway, I will fix it now. Thanks a lot for your quick answer.&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Fri, 18 Mar 2011 15:44:52 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/ifort-openmp-evaluates-ASSOCIATED-on-empty-pointer-to-TRUE/m-p/753856#M9467</guid>
      <dc:creator>wimr</dc:creator>
      <dc:date>2011-03-18T15:44:52Z</dc:date>
    </item>
    <item>
      <title>ifort+openmp evaluates ASSOCIATED on empty pointer to TRUE</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/ifort-openmp-evaluates-ASSOCIATED-on-empty-pointer-to-TRUE/m-p/753857#M9468</link>
      <description>Glad to hear it. By the way, I tried using the compiler's Static Security Analysis feature, used in conjunction with Intel Inspector XE, and it identified the uninitialized variable.</description>
      <pubDate>Fri, 18 Mar 2011 16:05:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/ifort-openmp-evaluates-ASSOCIATED-on-empty-pointer-to-TRUE/m-p/753857#M9468</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2011-03-18T16:05:20Z</dc:date>
    </item>
    <item>
      <title>ifort+openmp evaluates ASSOCIATED on empty pointer to TRUE</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/ifort-openmp-evaluates-ASSOCIATED-on-empty-pointer-to-TRUE/m-p/753858#M9469</link>
      <description>If you need thread safe code then youmust notnullify in the declaration because that makes the pointer implicitly persistent und thus thread unsafe(like SAVE).&lt;BR /&gt;&lt;BR /&gt;It's inconvenient butthenullify must be done seperately.</description>
      <pubDate>Thu, 31 Mar 2011 15:33:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/ifort-openmp-evaluates-ASSOCIATED-on-empty-pointer-to-TRUE/m-p/753858#M9469</guid>
      <dc:creator>mriedman</dc:creator>
      <dc:date>2011-03-31T15:33:51Z</dc:date>
    </item>
  </channel>
</rss>

