<?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 does Inspector not like -assume realloc_lhs ? in Analyzers</title>
    <link>https://community.intel.com/t5/Analyzers/does-Inspector-not-like-assume-realloc-lhs/m-p/768956#M238</link>
    <description>Thanks for looking into this.&lt;BR /&gt;&lt;BR /&gt;Unfortunately, the work-around is so easy for me that I have not found time to try to come up with a reproducer. It is good to know your test case is handled well though - if/when I get time to look again at this issue, I'll be sure to update this thread.</description>
    <pubDate>Sat, 23 Apr 2011 22:31:01 GMT</pubDate>
    <dc:creator>Alexis_R_</dc:creator>
    <dc:date>2011-04-23T22:31:01Z</dc:date>
    <item>
      <title>does Inspector not like -assume realloc_lhs ?</title>
      <link>https://community.intel.com/t5/Analyzers/does-Inspector-not-like-assume-realloc-lhs/m-p/768952#M234</link>
      <description>I am using Inspector within a Fortran project and I have noticed that Inspector reports memory leaks for allocatable components of derived type objects which are on the rhs of an assignment at some point during the program execution. If I replace the assignment with a subroutine which does the same work (except of course without relying on ifort's -assume realloc_lhs magic), Inspector does not report those memory leaks.&lt;BR /&gt;&lt;BR /&gt;What am I to conclude? Does Inspector not keep track properly when -assume realloc_lhs is in place, or is realloc_lhs actually causing a memory leak?</description>
      <pubDate>Tue, 05 Apr 2011 22:53:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/does-Inspector-not-like-assume-realloc-lhs/m-p/768952#M234</guid>
      <dc:creator>Alexis_R_</dc:creator>
      <dc:date>2011-04-05T22:53:50Z</dc:date>
    </item>
    <item>
      <title>does Inspector not like -assume realloc_lhs ?</title>
      <link>https://community.intel.com/t5/Analyzers/does-Inspector-not-like-assume-realloc-lhs/m-p/768953#M235</link>
      <description>Could you please provide you code sample and command line used? I'll try to run it on my side and see what's going on.&lt;BR /&gt;To get compiler command line in Visual Studio, go to Project Properties-&amp;gt;Configuration properties-&amp;gt;Fortran-&amp;gt;Command Line.&lt;BR /&gt;&lt;BR /&gt;Also please let me know, what version of Inspector XE do you run? Is it the latest update 2?&lt;BR /&gt;Do you build your project with MS or Intel compiler?</description>
      <pubDate>Thu, 07 Apr 2011 11:01:37 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/does-Inspector-not-like-assume-realloc-lhs/m-p/768953#M235</guid>
      <dc:creator>Kirill_R_Intel</dc:creator>
      <dc:date>2011-04-07T11:01:37Z</dc:date>
    </item>
    <item>
      <title>does Inspector not like -assume realloc_lhs ?</title>
      <link>https://community.intel.com/t5/Analyzers/does-Inspector-not-like-assume-realloc-lhs/m-p/768954#M236</link>
      <description>Hi - thanks for getting back to me.&lt;BR /&gt;I have not had time to reproduce the problem on a small code example - I'll try to do that soon &amp;amp; will post here. For now, I can only reproduce on my full project.&lt;BR /&gt;In the meantime, the command I was using to build:&lt;BR /&gt;&lt;PRE&gt;[bash]ifort -fpp -assume realloc_lhs -warn all -gen-interfaces -warn notruncated_source -traceback -heap-arrays  -FR -O3  -openmp -openmp-report[/bash]&lt;/PRE&gt; The version of ifort is 12.0.3 20110309&lt;BR /&gt;The version of Inspector is Intel Inspector XE 2011 Update 1 (build 131372)&lt;BR /&gt;&lt;BR /&gt;I didn't know about the update 2 - I downloaded Inspector just a couple of days ago. If you think it might make a difference, I can try with update 2.</description>
      <pubDate>Thu, 07 Apr 2011 13:00:10 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/does-Inspector-not-like-assume-realloc-lhs/m-p/768954#M236</guid>
      <dc:creator>Alexis_R_</dc:creator>
      <dc:date>2011-04-07T13:00:10Z</dc:date>
    </item>
    <item>
      <title>does Inspector not like -assume realloc_lhs ?</title>
      <link>https://community.intel.com/t5/Analyzers/does-Inspector-not-like-assume-realloc-lhs/m-p/768955#M237</link>
      <description>I cannot reproduce this problem on my side, with a simple test case.&lt;BR /&gt;I don't know if this is an old bug in compiler, or this is a bugof Inspector XE for specific case. &lt;BR /&gt;&lt;BR /&gt;#inspxe-cl -version&lt;BR /&gt;Intel Inspector XE 2011 Update 1 (build 131372) Command Line tool&lt;BR /&gt;Copyright (C) 2009-2010 Intel Corporation. All rights reserved.&lt;BR /&gt;&lt;BR /&gt;#source /opt/intel/composerxe-&lt;STRONG&gt;2011.3.174&lt;/STRONG&gt;/bin/compilervars.sh intel64&lt;BR /&gt;&lt;BR /&gt;test program:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;[fxfortran]MODULE TEST_MOD

   IMPLICIT NONE

   PUBLIC :: MY_TYPE, NEW_MY_TYPE, MY_TYPE_ASSIGNMENT

   PRIVATE

   TYPE MY_TYPE
      PRIVATE
      REAL, DIMENSION(:), POINTER :: ARR =&amp;gt; NULL()
      INTEGER, POINTER :: REF_COUNT =&amp;gt; NULL()
   CONTAINS
      PROCEDURE :: SET_ARR
      PROCEDURE :: GET_ARR
      FINAL :: DISPOSE
   END TYPE

   INTERFACE ASSIGNMENT (=)
      MODULE PROCEDURE MY_TYPE_ASSIGNMENT
   END INTERFACE

CONTAINS

! Overriding intrinsic assignment

   SUBROUTINE MY_TYPE_ASSIGNMENT( LHS, RHS )
      TYPE(MY_TYPE), INTENT(IN) :: RHS
      TYPE(MY_TYPE), INTENT(OUT) :: LHS
      WRITE(*,*) 'In defined assignment subroutine'
      LHS % ARR =&amp;gt; RHS % ARR
      LHS % REF_COUNT =&amp;gt; RHS % REF_COUNT
      LHS % REF_COUNT = LHS % REF_COUNT + 1
      WRITE(*,*) 'Reference count is: ', LHS % REF_COUNT
   END SUBROUTINE

! Finalizer
   
   SUBROUTINE DISPOSE( THIS )
      TYPE(MY_TYPE) :: THIS
      Write(*,*) 'In DISPOSE %LOC(THIS) =',%LOC(THIS)
      IF ( ASSOCIATED( THIS % REF_COUNT ) ) THEN
         THIS % REF_COUNT = THIS % REF_COUNT - 1
         WRITE(*,*) 'ref_count = ', THIS % REF_COUNT
         IF ( THIS % REF_COUNT == 0 ) THEN
            WRITE(*,*) 'Finalizing MY_TYPE'
            IF ( ASSOCIATED( THIS % ARR ) ) THEN
               WRITE(*,*) 'Finalizing: ', THIS % ARR
               DEALLOCATE( THIS % ARR )
            END IF
            DEALLOCATE( THIS % REF_COUNT )
         END IF
      END IF 
   END SUBROUTINE

! Constructor

   FUNCTION NEW_MY_TYPE(  ) RESULT( NEW )
      TYPE(MY_TYPE) :: NEW
      ALLOCATE( NEW % REF_COUNT )
      NEW % REF_COUNT = 1
     write (*,*) 'In NEW_MY_TYPE %LOC(NEW) =',%LOC(NEW)
   END FUNCTION

! Accessors

   SUBROUTINE SET_ARR( THIS, ARR )
      CLASS(MY_TYPE) :: THIS
      REAL, DIMENSION(:) :: ARR
      ALLOCATE( THIS % ARR( SIZE( ARR ) ) )
      THIS % ARR(:) = ARR(:)
   END SUBROUTINE

   FUNCTION GET_ARR( THIS ) RESULT( ARR )
      CLASS(MY_TYPE) :: THIS
      REAL, DIMENSION(:), POINTER :: ARR
      ARR =&amp;gt; THIS % ARR
   END FUNCTION

END MODULE

SUBROUTINE TEST_SUB

   USE TEST_MOD

   IMPLICIT NONE

   TYPE(MY_TYPE) :: OBJ, OBJ2
   REAL, POINTER :: ARR(:)


   write(*,*) 'Creating new instance'
   OBJ = NEW_MY_TYPE( ) !&amp;lt;---- Function result value is not finalized after assignment
   write(*,*) 'Finished creating new instance'
   CALL OBJ % SET_ARR( [ 1.0, 2.0, 3.0 ] )

   write(*,*) 'New reference begin'
   OBJ2 = OBJ
   write(*,*) 'New reference end'

   ARR =&amp;gt; OBJ % GET_ARR()
   WRITE(*,*) ARR

END SUBROUTINE

PROGRAM TEST
   CALL TEST_SUB
END PROGRAM
   
[/fxfortran]&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;Then build it:&lt;BR /&gt;[root@NHM02 problem_report]# ifort -g -check -assume realloc_lhs -warn ref_count.f90&lt;BR /&gt;&lt;BR /&gt;[root@NHM02 problem_report]# inspxe-cl -collect mi3 -- ./a.out&lt;BR /&gt;Used suppression file(s): []&lt;BR /&gt;Creating new instance&lt;BR /&gt;In NEW_MY_TYPE %LOC(NEW) = 140736338714992&lt;BR /&gt;In DISPOSE %LOC(THIS) = 140736338714832&lt;BR /&gt;In defined assignment subroutine&lt;BR /&gt;Reference count is: 2&lt;BR /&gt;In DISPOSE %LOC(THIS) = 140736338714992&lt;BR /&gt;ref_count = 1&lt;BR /&gt;Finished creating new instance&lt;BR /&gt;New reference begin&lt;BR /&gt;In DISPOSE %LOC(THIS) = 140736338714912&lt;BR /&gt;In defined assignment subroutine&lt;BR /&gt;Reference count is: 2&lt;BR /&gt;New reference end&lt;BR /&gt; 1.000000 2.000000 3.000000&lt;BR /&gt;In DISPOSE %LOC(THIS) = 140736338714832&lt;BR /&gt;ref_count = 1&lt;BR /&gt;In DISPOSE %LOC(THIS) = 140736338714912&lt;BR /&gt;ref_count = 0&lt;BR /&gt;Finalizing MY_TYPE&lt;BR /&gt;Finalizing: 1.000000 2.000000 3.000000 &lt;P&gt;&lt;STRONG&gt;0 new problem(s) found&lt;BR /&gt;&lt;BR /&gt;&lt;/STRONG&gt;Regards, Peter&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Apr 2011 08:37:32 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/does-Inspector-not-like-assume-realloc-lhs/m-p/768955#M237</guid>
      <dc:creator>Peter_W_Intel</dc:creator>
      <dc:date>2011-04-08T08:37:32Z</dc:date>
    </item>
    <item>
      <title>does Inspector not like -assume realloc_lhs ?</title>
      <link>https://community.intel.com/t5/Analyzers/does-Inspector-not-like-assume-realloc-lhs/m-p/768956#M238</link>
      <description>Thanks for looking into this.&lt;BR /&gt;&lt;BR /&gt;Unfortunately, the work-around is so easy for me that I have not found time to try to come up with a reproducer. It is good to know your test case is handled well though - if/when I get time to look again at this issue, I'll be sure to update this thread.</description>
      <pubDate>Sat, 23 Apr 2011 22:31:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/does-Inspector-not-like-assume-realloc-lhs/m-p/768956#M238</guid>
      <dc:creator>Alexis_R_</dc:creator>
      <dc:date>2011-04-23T22:31:01Z</dc:date>
    </item>
    <item>
      <title>does Inspector not like -assume realloc_lhs ?</title>
      <link>https://community.intel.com/t5/Analyzers/does-Inspector-not-like-assume-realloc-lhs/m-p/768957#M239</link>
      <description>Yeah, just a reminder - please use latest ifort 12.3 or above,with Inspector XE 2011 Update 1.&lt;BR /&gt;&lt;BR /&gt;It's better that you can provide me a simple test case to reproduce this problem. Thank you.</description>
      <pubDate>Mon, 25 Apr 2011 03:23:50 GMT</pubDate>
      <guid>https://community.intel.com/t5/Analyzers/does-Inspector-not-like-assume-realloc-lhs/m-p/768957#M239</guid>
      <dc:creator>Peter_W_Intel</dc:creator>
      <dc:date>2011-04-25T03:23:50Z</dc:date>
    </item>
  </channel>
</rss>

