<?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 Or consider: in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027398#M109604</link>
    <description>&lt;P&gt;Or consider:&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;&amp;nbsp;function sum_abs_operator_apply(op,arg) result(res)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; implicit none
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class(sum_abs_operator), intent(in)&amp;nbsp; :: op
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class(abs_operand)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , intent(in)&amp;nbsp; :: arg
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class(abs_operand)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , pointer&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :: res
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; integer, parameter&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :: MAX_LIFETIME = 100
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class(abs_operand)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , SAVE  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :: res_save(MAX_LIFETIME)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; integer&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , SAVE  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :: i = 1 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; res_save(i) = op%op1%apply(arg) + op%op2%apply(arg)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; res =&amp;gt; res_save
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i = i + 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(i .gt. MAX_LIFETIME) i = 1
&amp;nbsp;&amp;nbsp; end function sum_abs_operator_apply
&lt;/PRE&gt;

&lt;P&gt;This would provide a longer lifetime. You will have to decide what is safe for the lifetime.&lt;/P&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
    <pubDate>Mon, 20 Oct 2014 12:56:43 GMT</pubDate>
    <dc:creator>jimdempseyatthecove</dc:creator>
    <dc:date>2014-10-20T12:56:43Z</dc:date>
    <item>
      <title>Issue with the usage of Fortran2003 OO advanced features</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027389#M109595</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt;

&lt;P&gt;for a new project, we are considering the exploitation of some of the advanced features of the Fortran 2003 standard, essentially run-time polymorphism via abstract data types.&lt;/P&gt;

&lt;P&gt;The attached package contains a set of several Fortran 2003 sources files (together with the corresponding compilation bash script) that declare&lt;BR /&gt;
	two abstract data types for an operator [type(abs_operator)] (in its strict linear algebra sense, as e.g., a matrix) and its operands [type(abs_operands)] (e.g., a vector), respectively. An operator "is applied" to an operand, and returns a (pointer to) an operand. This "is applied" action is implemented thorough a deferred function of the operator.&amp;nbsp; [The current implementation of a matrix and a vector is only a toy implementation, don't&lt;BR /&gt;
	pay too much attention into it].&lt;/P&gt;

&lt;P&gt;Besides, we would like to create new operators by combining existing ones using overloaded +, *, etc. In order to overload +, a realization of an operator, type(sum_abs_operator), is declared, and its constructor, that takes two operators, and returns type(sum_abs_operator),&lt;BR /&gt;
	is used for that purpose. The same strategy is used for *. Such overloading is done for the operator abstract data type.&lt;/P&gt;

&lt;P&gt;Using all these machinery as currently implemented, we are getting SIGSEV when executing the main program (drive_fops.f90) with ifort 13.0.1., 14.0.1, and 14.0.2 (the ones that we could test so far). In particular, in the implementation of the apply method corresponding to type(sum_abs_operator):&lt;/P&gt;

&lt;P&gt;&amp;nbsp; function sum_abs_operator_apply(op,arg) result(res)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; implicit none&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; class(sum_abs_operator), intent(in)&amp;nbsp; :: op&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; class(abs_operand)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , intent(in)&amp;nbsp; :: arg&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; class(abs_operand)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , pointer&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :: res&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; res =&amp;gt; op%op1%apply(arg) + op%op2%apply(arg)&lt;BR /&gt;
	&amp;nbsp; end function sum_abs_operator_apply&lt;/P&gt;

&lt;P&gt;a SIGSEV is triggered during the evaluation of " res=&amp;gt; ...". However, if implemented as:&lt;/P&gt;

&lt;P&gt;&amp;nbsp; function sum_abs_operator_apply(op,arg) result(res)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; implicit none&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; class(sum_abs_operator), intent(in)&amp;nbsp; :: op&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; class(abs_operand)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , intent(in)&amp;nbsp; :: arg&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; class(abs_operand)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , pointer&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :: res&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; class(abs_operand)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , pointer&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :: tmp1, tmp2&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; tmp1 =&amp;gt; op%op1%apply(arg)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; tmp2 =&amp;gt; op%op2%apply(arg)&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; res =&amp;gt; tmp1 + tmp2&lt;BR /&gt;
	&amp;nbsp; end function sum_abs_operator_apply&lt;/P&gt;

&lt;P&gt;then everything works fine (and they seem to be pretty similar to each other). The strange&lt;BR /&gt;
	thing about the SIGSEV is that during the evaluation of " res=&amp;gt; ...", it seems that the&lt;BR /&gt;
	compiler is not calling the vector realization of the deferred function that overloads&lt;BR /&gt;
	+ for the abstract operand, but that of the abstract operator (i.e., sum_abs_operator_construct).&lt;/P&gt;

&lt;P&gt;May be there is no issue, and it is our missunderstanding, but we&lt;BR /&gt;
	have no clue about what could be causing this. We would highly appreciate any advice&lt;BR /&gt;
	that you could give us in that respect. Also, as we are beginning the usage of&lt;BR /&gt;
	these OO features of Fortran2003 we would also appreciate if you have any suggestion&lt;BR /&gt;
	on how to implement all this machinery in a better/cleaner/safer way (if any).&lt;/P&gt;

&lt;P&gt;Thanks very much in advance.&lt;/P&gt;

&lt;P&gt;Best regards,&lt;BR /&gt;
	&amp;nbsp;Alberto.&lt;/P&gt;</description>
      <pubDate>Thu, 16 Oct 2014 22:11:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027389#M109595</guid>
      <dc:creator>Alberto_F__M_</dc:creator>
      <dc:date>2014-10-16T22:11:40Z</dc:date>
    </item>
    <item>
      <title>Dear All,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027390#M109596</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt;

&lt;P&gt;find attached a bug-fix (related to unappropriate pointer handling) for two of the files included in f03oo_issue_reproducer.tgz. Despite this bug-fix, the issue still persists.&lt;/P&gt;

&lt;P&gt;Best regards,&lt;/P&gt;

&lt;P&gt;&amp;nbsp;Alberto.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Oct 2014 11:40:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027390#M109596</guid>
      <dc:creator>Alberto_F__M_</dc:creator>
      <dc:date>2014-10-17T11:40:02Z</dc:date>
    </item>
    <item>
      <title>See what the following do:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027391#M109597</link>
      <description>&lt;P&gt;See what the following do:&lt;/P&gt;

&lt;P&gt;res =&amp;gt; &lt;STRONG&gt;(&lt;/STRONG&gt;op%op1%apply(arg) + op%op2%apply(arg)&lt;STRONG&gt;)&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;res =&amp;gt; &lt;STRONG&gt;((&lt;/STRONG&gt;op%op1%apply(arg)&lt;STRONG&gt;)&lt;/STRONG&gt; + &lt;STRONG&gt;(&lt;/STRONG&gt;op%op2%apply(arg)&lt;STRONG&gt;))&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;RE: drive_fops&lt;/P&gt;

&lt;P&gt;The deallocate's at the end are likely problematic as the pointee may not be allocatable (in the case of v it is not allocatable)&lt;/P&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Fri, 17 Oct 2014 13:02:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027391#M109597</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2014-10-17T13:02:56Z</dc:date>
    </item>
    <item>
      <title>Dear Jim,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027392#M109598</link>
      <description>&lt;P&gt;Dear Jim,&lt;/P&gt;

&lt;P&gt;thanks for your response. The expressions you provided do not compile (see error messages below). I do not actually understand the error message. Any clue of what's going on ?&lt;/P&gt;

&lt;P&gt;Best regards,&lt;/P&gt;

&lt;P&gt;Alberto.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;ifort -c -module Objects -g -O0 -r8 -traceback -debug all -check all -ftrapuv -stand f03 -o Objects/foperator.o foperator.f90&lt;BR /&gt;
	foperator.f90(140): error #6678: When the target is an expression it must deliver a pointer result.&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; res =&amp;gt; ( op%op1%apply(arg) + op%op2%apply(arg) )&lt;BR /&gt;
	-------------------------------^&lt;/P&gt;

&lt;P&gt;ifort -c -module Objects -g -O0 -r8 -traceback -debug all -check all -ftrapuv -stand f03 -o Objects/foperator.o foperator.f90&lt;BR /&gt;
	foperator.f90(140): error #6678: When the target is an expression it must deliver a pointer result.&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; res =&amp;gt; ( (op%op1%apply(arg)) + (op%op2%apply(arg)) )&lt;BR /&gt;
	---------------------------------^&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 17 Oct 2014 16:30:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027392#M109598</guid>
      <dc:creator>Alberto_F__M_</dc:creator>
      <dc:date>2014-10-17T16:30:24Z</dc:date>
    </item>
    <item>
      <title>You're using pointer</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027393#M109599</link>
      <description>&lt;P&gt;You're using pointer assignment (=&amp;gt;). Here you probably want just intrinsic assignment (=). I have not looked at your whole code.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Oct 2014 17:24:48 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027393#M109599</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2014-10-17T17:24:48Z</dc:date>
    </item>
    <item>
      <title>It looked to me as if the</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027394#M109600</link>
      <description>&lt;P&gt;It looked to me as if the pointer=&amp;gt; construct was intended to point to the temporary expression result. I haven't read the latest standards to see if this were permitted. I apologize for any inconvenience my reply may have caused.&lt;/P&gt;

&lt;P&gt;The assignment operator (=) will work, but it may also require a copy operation (though the optimization process may result in generating the result in the lhs of = as opposed to in a temp then copy.&lt;/P&gt;

&lt;P&gt;An alternate method might be to use the ASSOCIATE which may produce the same functionality as intended by the code using the pointer=&amp;gt;.&lt;/P&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Fri, 17 Oct 2014 18:39:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027394#M109600</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2014-10-17T18:39:38Z</dc:date>
    </item>
    <item>
      <title>No, you can't point to an</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027395#M109601</link>
      <description>&lt;P&gt;No, you can't point to an expression. You can only point to things that have the TARGET attribute and there is no way to give an expression that attribute.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Oct 2014 02:27:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027395#M109601</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2014-10-18T02:27:00Z</dc:date>
    </item>
    <item>
      <title>Sure? Here "+" is (should be)</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027396#M109602</link>
      <description>&lt;P&gt;Sure? Here "+" is (should be) overloaded with a function that returns a pointer. As far as I understand you can point to a pointer, right? I mean, a pointer is intrinsically a target, right? Would the assignment operator work in this case? I would say no.&lt;/P&gt;

&lt;P&gt;In the example posted by Alberto (we work together) everything works fine when doing&lt;/P&gt;

&lt;P&gt;tmp1 + tmp2&lt;/P&gt;

&lt;P&gt;both being pointers defined locally whereas doing&lt;/P&gt;

&lt;P&gt;op%op1%apply(arg) + op%op2%apply(arg)&lt;/P&gt;

&lt;P&gt;a SIGSEV occurs.&lt;/P&gt;

&lt;P&gt;If we (Alberto and me) are right, in the second case the compiler is overloading + with the wrong function (sum_abs_operator_constructor), the one acting on op which is a type that bounds the procedure apply that returns a vector, instead of doing it with the one acting on vectors (addvec). Introducing local pointers tmp =&amp;gt; op%op1%apply(arg) everything works fine.&lt;/P&gt;

&lt;P&gt;Many thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2014 09:19:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027396#M109602</guid>
      <dc:creator>Javier_Principe</dc:creator>
      <dc:date>2014-10-20T09:19:16Z</dc:date>
    </item>
    <item>
      <title>Putting together what Steve</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027397#M109603</link>
      <description>&lt;P&gt;Putting together what Steve last said&amp;nbsp;&lt;EM&gt; you can't point to an expression&lt;/EM&gt;, which in the case I presented was &lt;EM&gt;a result of an expression&lt;/EM&gt;, and which appears to be what you want for desired behavior. It would then lead to res =&amp;gt; tmp1 + tmp2 producing a result of an expression&amp;nbsp;of which you are assigning a pointer to. The fact that the compiler does not emit an error message would then be indicative of an error in the compiler.&lt;/P&gt;

&lt;P&gt;In your attached .f90 files you return a pointer to a newly allocated object, which is correct. In the code presented in first post you do not, which is wrong. You could do something like:&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;&amp;nbsp;function sum_abs_operator_apply(op,arg) result(res)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; implicit none
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class(sum_abs_operator), intent(in)&amp;nbsp; :: op
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class(abs_operand)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , intent(in)&amp;nbsp; :: arg
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class(abs_operand)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , pointer&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :: res
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class(abs_operand)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , SAVE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :: res_save
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; res_save = op%op1%apply(arg) + op%op2%apply(arg)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; res =&amp;gt; res_save
&amp;nbsp;&amp;nbsp; end function sum_abs_operator_apply&lt;/PRE&gt;

&lt;P&gt;However, this restricts your code to having only one sum_abs_operator_apply object pending at any one time. And code that would not be thread safe.&lt;/P&gt;

&lt;P&gt;While you could ALLOCATE the return object and point res at it, then you have to assure that somehow the object is deleted at the appropriate time. This would mean you would need to add reference counting and garbage collection, etc...&lt;/P&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2014 12:46:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027397#M109603</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2014-10-20T12:46:53Z</dc:date>
    </item>
    <item>
      <title>Or consider:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027398#M109604</link>
      <description>&lt;P&gt;Or consider:&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;&amp;nbsp;function sum_abs_operator_apply(op,arg) result(res)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; implicit none
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class(sum_abs_operator), intent(in)&amp;nbsp; :: op
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class(abs_operand)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , intent(in)&amp;nbsp; :: arg
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class(abs_operand)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , pointer&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :: res
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; integer, parameter&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :: MAX_LIFETIME = 100
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class(abs_operand)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , SAVE  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :: res_save(MAX_LIFETIME)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; integer&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , SAVE  &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :: i = 1 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; res_save(i) = op%op1%apply(arg) + op%op2%apply(arg)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; res =&amp;gt; res_save
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i = i + 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(i .gt. MAX_LIFETIME) i = 1
&amp;nbsp;&amp;nbsp; end function sum_abs_operator_apply
&lt;/PRE&gt;

&lt;P&gt;This would provide a longer lifetime. You will have to decide what is safe for the lifetime.&lt;/P&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2014 12:56:43 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027398#M109604</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2014-10-20T12:56:43Z</dc:date>
    </item>
    <item>
      <title>Jim, your code does not</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027399#M109605</link>
      <description>&lt;P&gt;Jim, your code does not compile (see the errors below). Once again:&lt;/P&gt;

&lt;P&gt;+ is overloaded with a function that returns a pointer&lt;/P&gt;

&lt;P&gt;In fact, the following error (which I got in another context using the Intel compiler) explicitly says that you can point to an expression:&lt;/P&gt;

&lt;P&gt;error #6678: When the target is an expression it must deliver a pointer result. error #6678: When the target is an expression it must deliver a pointer result.&lt;/P&gt;

&lt;P&gt;We are quite convinced that the problem is the wrong overloading but we would be 100% sure. We really appreciate your help in clarifying the issue.&lt;/P&gt;

&lt;P&gt;Many thanks,&lt;/P&gt;

&lt;P&gt;foperator.f90(150): error #8304: In an intrinsic assignment statement, variable shall not be polymorphic.&amp;nbsp;&amp;nbsp; [RES_SAVE]&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; res_save = op%op1%apply(arg) + op%op2%apply(arg)&lt;BR /&gt;
	----^&lt;BR /&gt;
	foperator.f90(151): error #6796: The variable must have the TARGET attribute or be a subobject of an object with the TARGET attribute, or it must have the POINTER attribute.&amp;nbsp;&amp;nbsp; [RES_SAVE]&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; res =&amp;gt; res_save&lt;BR /&gt;
	-----------^&lt;BR /&gt;
	foperator.f90(149): error #8223: An entity declared with the CLASS keyword shall be a dummy argument or have the ALLOCATABLE or POINTER attribute.&amp;nbsp;&amp;nbsp; [RES_SAVE]&lt;BR /&gt;
	&amp;nbsp;&amp;nbsp;&amp;nbsp; class(abs_operand)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , SAVE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :: res_save&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2014 14:56:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027399#M109605</guid>
      <dc:creator>Javier_Principe</dc:creator>
      <dc:date>2014-10-20T14:56:36Z</dc:date>
    </item>
    <item>
      <title>Considering the error message</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027400#M109606</link>
      <description>&lt;P&gt;Considering the error message:&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;&amp;nbsp;function sum_abs_operator_apply(op,arg) result(res)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; implicit none
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class(sum_abs_operator), intent(in)&amp;nbsp; :: op
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class(abs_operand)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , intent(in)&amp;nbsp; :: arg
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class(abs_operand)&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , pointer&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :: res
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; integer, parameter&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :: MAX_LIFETIME = 100
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class(abs_operand), pointer, SAVE&amp;nbsp;&amp;nbsp;&amp;nbsp; :: res_save(MAX_LIFETIME)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; integer&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , SAVE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; :: i = 1

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select type(arg)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type is(vector)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; select type(res)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; type is(vector)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(.not.associated(res_save(i))) allocate(vector::res_save(i))
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; res = res_save(i) ! note = to copy pointer not =&amp;gt;, though =&amp;gt; may work as well
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; i = i + 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(i .gt. MAX_LIFETIME) i = 1
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ! type is(...)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end select
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; class default
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; write(*,*) 'This realization of operator (vector) cannot be applied'
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; write(*,*) 'to this realization of operand'
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end select
&amp;nbsp;&amp;nbsp; end function sum_abs_operator_apply

&lt;/PRE&gt;

&lt;P&gt;Would that work?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2014 16:30:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027400#M109606</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2014-10-20T16:30:16Z</dc:date>
    </item>
    <item>
      <title>Note, it would be better to</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027401#M109607</link>
      <description>&lt;P&gt;Note, it would be better to take the array of pointers out of the function and place them in the scope of the module (with the contains function sum_abs_...) and use multiple arrays of&amp;nbsp;your various types. These arrays can then have a proper init to NULLIFY the initial entries, and if desired DEALLOCATE's to reclaim memory at appropriate times.&lt;/P&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2014 16:34:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027401#M109607</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2014-10-20T16:34:45Z</dc:date>
    </item>
    <item>
      <title>We have compiled the code</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027402#M109608</link>
      <description>&lt;P&gt;We have compiled the code using the IBM compiler and the problem disappeared. It is quite clear that this an IFC issue: it is overloading the wrong function.&lt;/P&gt;

&lt;P&gt;Best&lt;/P&gt;</description>
      <pubDate>Tue, 21 Oct 2014 13:17:02 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027402#M109608</guid>
      <dc:creator>Javier_Principe</dc:creator>
      <dc:date>2014-10-21T13:17:02Z</dc:date>
    </item>
    <item>
      <title>Javier, which code did you</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027403#M109609</link>
      <description>&lt;P&gt;Javier, which code did you compile? Please attach the source you used.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Oct 2014 15:51:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027403#M109609</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2014-10-21T15:51:49Z</dc:date>
    </item>
    <item>
      <title>The same code Alberto posted</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027404#M109610</link>
      <description>&lt;P&gt;The same code Alberto posted with the minor corrections he uploaded afterwards (the bug he corrected is unrelated to the issue). I attach it again in a single package to make it easier for you. Download it, compile.sh and it works. Go to foperator.f90 uncomment line 141, comment lines 146-148, and you will see the SIGSEV. You will also see a print from the (wrongly) overloaded function.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Oct 2014 16:38:19 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027404#M109610</guid>
      <dc:creator>Javier_Principe</dc:creator>
      <dc:date>2014-10-21T16:38:19Z</dc:date>
    </item>
    <item>
      <title>Thanks - we'll take a look.</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027405#M109611</link>
      <description>&lt;P&gt;Thanks - we'll take a look.&lt;/P&gt;

&lt;P&gt;By the way, I see that the build script uses -ftrapuv. I recommend not using that - it doesn't add any value.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Oct 2014 17:29:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027405#M109611</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2014-10-21T17:29:16Z</dc:date>
    </item>
    <item>
      <title>Quote:Javier Principe wrote:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027406#M109612</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;Javier Principe wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;We have compiled the code using the IBM compiler and the problem disappeared. It is quite clear that this an IFC issue: it is overloading the wrong function.&lt;/P&gt;

&lt;P&gt;Best&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Javier,&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="line-height: 19.5120010375977px;"&gt;Have you tried Intel compiler version 15? &amp;nbsp;&lt;/SPAN&gt;FWIW, your program doesn't generate any segmentation violation error with Intel Fortran 15.0.0.108 on Windows. &amp;nbsp;The output is as follows:&lt;/P&gt;

&lt;PRE class="brush:plain;"&gt; XXX
 XXX
 9.00000000000000 9.00000000000000
 2.00000000000000 2.00000000000000
 2.00000000000000 2.00000000000000
Press any key to continue . . .
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Oct 2014 21:01:11 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027406#M109612</guid>
      <dc:creator>FortranFan</dc:creator>
      <dc:date>2014-10-21T21:01:11Z</dc:date>
    </item>
    <item>
      <title>Dear FortranFan,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027407#M109613</link>
      <description>&lt;P&gt;Dear FortranFan,&lt;/P&gt;

&lt;P&gt;just to be sure, did you follow the instructions pointed by Javier to reproduce the issue?, i.e.,&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
	&lt;P&gt;Go to foperator.f90 uncomment line 141, comment lines 146-148, and you will see the SIGSEV.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;I tried Intel Fortran compiler for Linux, versions 14.0.3.174, 14.0.4.211, and 15.0.0.090, and the SIGSEV is still there.&lt;/P&gt;

&lt;P&gt;Best regards,&lt;/P&gt;

&lt;P&gt;Alberto.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Oct 2014 22:06:08 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027407#M109613</guid>
      <dc:creator>Alberto_F__M_</dc:creator>
      <dc:date>2014-10-21T22:06:08Z</dc:date>
    </item>
    <item>
      <title>I was able to reproduce the</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027408#M109614</link>
      <description>&lt;P&gt;I was able to reproduce the problem in 15.0.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Oct 2014 23:03:13 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Issue-with-the-usage-of-Fortran2003-OO-advanced-features/m-p/1027408#M109614</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2014-10-21T23:03:13Z</dc:date>
    </item>
  </channel>
</rss>

