<?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 Re: Recursive function causes compile-time error in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-function-causes-compile-time-error/m-p/756838#M12325</link>
    <description>Obviously I didn't look closely enough at the code to see that the problem was not the recursive call but the variable with the same name as the function :) So your suggestion of course fixed the problem. Many thanks.</description>
    <pubDate>Sat, 01 Mar 2003 07:03:39 GMT</pubDate>
    <dc:creator>jfkfcia</dc:creator>
    <dc:date>2003-03-01T07:03:39Z</dc:date>
    <item>
      <title>Recursive function causes compile-time error</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-function-causes-compile-time-error/m-p/756836#M12323</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;I have a simple recursive function that causes compilation with ifc to fail. It's as if recursion is not being allowed. The errors reported are:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;
      splinen = ( (x+n/2.)*splinen(x+0.5,n-1)
                           ^
Error 282 at (612:tfed.f) : This is not the name of a function but of a function result
     *     +(n/2.-x)*splinen(x-0.5,n-1))/(n-1)
                     ^
Error 282 at (613:tfed.f) : This is not the name of a function but of a function result
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;The code compiles fine with PGI and SGI MIPSPro compilers. Here is the function:&lt;BR /&gt;&lt;BR /&gt;&lt;PRE&gt;
  RECURSIVE FUNCTION splinen(x,n)
  REAL x
  INTEGER n

  IF(n.eq.1) THEN
      IF(x.ge.-0.5 .and. x&amp;lt;0.5 ) THEN
          splinen = 1
      ELSE
          splinen = 0
      END IF
      RETURN
  ENDIF
  IF(abs(x)&amp;gt;n/2.) THEN
      splinen = 0
      RETURN
  ENDIF
  splinen = ( (x+n/2.)*splinen(x+0.5,n-1)
 F                    +(n/2.-x)*splinen(x-0.5,n-1))/(n-1)

  RETURN
  END
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;I don't see any relevant options in the manual, that I am not already using. I am compiling with the flags: -O2 -opt_report -WB -mp -openmp -fpp1 -auto -pc64 -c -cm -w95 -tpp7 -xW.&lt;BR /&gt;&lt;BR /&gt;Thanks for any suggestions,&lt;BR /&gt;jfk.</description>
      <pubDate>Fri, 28 Feb 2003 05:11:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-function-causes-compile-time-error/m-p/756836#M12323</guid>
      <dc:creator>jfkfcia</dc:creator>
      <dc:date>2003-02-28T05:11:38Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive function causes compile-time error</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-function-causes-compile-time-error/m-p/756837#M12324</link>
      <description>You might try writing the function like this:&lt;BR /&gt;&lt;BR /&gt;RECURSIVE FUNCTION splinen(x,n) RESULT(answer)&lt;BR /&gt;  REAL x&lt;BR /&gt;  INTEGER n,answer&lt;BR /&gt;  IF(n.eq.1) THEN&lt;BR /&gt;     IF(x.ge.-0.5 .and. x&amp;lt;0.5 ) THEN&lt;BR /&gt;        answer = 1&lt;BR /&gt;     ELSE&lt;BR /&gt;        answer = 0&lt;BR /&gt;     END IF&lt;BR /&gt;     RETURN&lt;BR /&gt;  ENDIF&lt;BR /&gt;  IF(abs(x)&amp;gt;n/2.) THEN&lt;BR /&gt;     answer = 0&lt;BR /&gt;     RETURN&lt;BR /&gt;  ENDIF&lt;BR /&gt;  answer = ( (x+n/2.)*splinen(x+0.5,n-1)+(n/2.-x)*splinen(x-0.5,n-1))/(n-1)&lt;BR /&gt;END FUNCTION splinen&lt;BR /&gt;</description>
      <pubDate>Fri, 28 Feb 2003 23:59:49 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-function-causes-compile-time-error/m-p/756837#M12324</guid>
      <dc:creator>sburger</dc:creator>
      <dc:date>2003-02-28T23:59:49Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive function causes compile-time error</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-function-causes-compile-time-error/m-p/756838#M12325</link>
      <description>Obviously I didn't look closely enough at the code to see that the problem was not the recursive call but the variable with the same name as the function :) So your suggestion of course fixed the problem. Many thanks.</description>
      <pubDate>Sat, 01 Mar 2003 07:03:39 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-function-causes-compile-time-error/m-p/756838#M12325</guid>
      <dc:creator>jfkfcia</dc:creator>
      <dc:date>2003-03-01T07:03:39Z</dc:date>
    </item>
  </channel>
</rss>

