<?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 PURE Functions in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/PURE-Functions/m-p/785976#M30046</link>
    <description>&lt;P&gt;I've defined a code module (a Fortran F90 file) and supplied it with these two subroutines:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;pure Subroutine XRotation (x, y, z, Xrot, xp, yp, zp)
! Rotate about X-axis through the angle Xrot

real*4, INTENT(IN) :: x, y, z, xrot
real*4, INTENT(OUT) :: xp, yp, zp
real*4 xrad

Xrad = Xrot * 3.141592627 / 180 ! Convert to radians
yp = y * COS(Xrad) + z * SIN(Xrad)
xp = x
zp = z * COS(Xrad) - y * SIN(Xrad)


END


Pure Subroutine DummyDummy()

Call XRotation(1,2,3,4,5,6,7)

End Subroutine
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The compiler (Intel Fortran 12, targeting 32-bit Windows, for whatever that's worth) returns a single error message:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
  &lt;P&gt;error #7137: Any procedure referenced in a PURE procedure, including
  one referenced via a defined operation or assignment, must be
  explicitly declared PURE.   [XROTATION]&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;I'm a little bit stumped. How can I change this code so that the PURE Subroutine "DummyDummy" compiles? &lt;/P&gt;</description>
    <pubDate>Fri, 23 Mar 2012 00:51:31 GMT</pubDate>
    <dc:creator>RobP</dc:creator>
    <dc:date>2012-03-23T00:51:31Z</dc:date>
    <item>
      <title>PURE Functions</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/PURE-Functions/m-p/785976#M30046</link>
      <description>&lt;P&gt;I've defined a code module (a Fortran F90 file) and supplied it with these two subroutines:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;pure Subroutine XRotation (x, y, z, Xrot, xp, yp, zp)
! Rotate about X-axis through the angle Xrot

real*4, INTENT(IN) :: x, y, z, xrot
real*4, INTENT(OUT) :: xp, yp, zp
real*4 xrad

Xrad = Xrot * 3.141592627 / 180 ! Convert to radians
yp = y * COS(Xrad) + z * SIN(Xrad)
xp = x
zp = z * COS(Xrad) - y * SIN(Xrad)


END


Pure Subroutine DummyDummy()

Call XRotation(1,2,3,4,5,6,7)

End Subroutine
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The compiler (Intel Fortran 12, targeting 32-bit Windows, for whatever that's worth) returns a single error message:&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
  &lt;P&gt;error #7137: Any procedure referenced in a PURE procedure, including
  one referenced via a defined operation or assignment, must be
  explicitly declared PURE.   [XROTATION]&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;I'm a little bit stumped. How can I change this code so that the PURE Subroutine "DummyDummy" compiles? &lt;/P&gt;</description>
      <pubDate>Fri, 23 Mar 2012 00:51:31 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/PURE-Functions/m-p/785976#M30046</guid>
      <dc:creator>RobP</dc:creator>
      <dc:date>2012-03-23T00:51:31Z</dc:date>
    </item>
    <item>
      <title>PURE Functions</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/PURE-Functions/m-p/785977#M30047</link>
      <description>You have a couple of problems. First, you don't have a module - you just have two external procedures. When DummyDummy is compiled, it has no idea what the interface to Xrotation is - in particular, it doesn't know it's PURE. If you actually put these in a module and made the two procedures contained, then it would see that. So you'd have...&lt;BR /&gt;&lt;BR /&gt;module mymod&lt;BR /&gt;contains&lt;BR /&gt;pure subroutine Xrotation...&lt;BR /&gt;...&lt;BR /&gt;end subroutine Xrotation&lt;BR /&gt;pure subroutine DummyDummy ...&lt;BR /&gt;...&lt;BR /&gt;end subroutine DummyDummy&lt;BR /&gt;end module mymod&lt;BR /&gt;&lt;BR /&gt;The second problem is that you have passed all constants as arguments to Xrotation, but three of them are INTENT(OUT) - the compiler won't like that either if you make the interface visible.</description>
      <pubDate>Fri, 23 Mar 2012 01:01:59 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/PURE-Functions/m-p/785977#M30047</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2012-03-23T01:01:59Z</dc:date>
    </item>
    <item>
      <title>PURE Functions</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/PURE-Functions/m-p/785978#M30048</link>
      <description>With respect to that second problem, it's a poorly written question. DummyDummy was written only to expose the compiler error. &lt;BR /&gt;&lt;BR /&gt;Thanks for the reminder about modules.</description>
      <pubDate>Fri, 23 Mar 2012 01:43:36 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/PURE-Functions/m-p/785978#M30048</guid>
      <dc:creator>RobP</dc:creator>
      <dc:date>2012-03-23T01:43:36Z</dc:date>
    </item>
  </channel>
</rss>

