<?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 Recursive subroutine with multiple calls in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-subroutine-with-multiple-calls/m-p/872979#M72801</link>
    <description>&lt;P&gt;Hello, &lt;/P&gt;
&lt;P&gt;I have a recursive subroutine which is called from a 'main' program, and which within its own source code calls itself on four separate occasions.&lt;/P&gt;
&lt;P&gt;If I put the recursive subroutine into a project by itself, it compiles with no errors.&lt;/P&gt;
&lt;P&gt;If I put the recursive subroutine into the same project as the 'main' program, then during the compilation an error is flagged in the recursive subroutine's source code for the second, third and fourth occurrences of it calling itself. The error message is "The same named entity from different modules and/or program units cannot be referenced". No error message is given for the first occurrence.&lt;/P&gt;
&lt;P&gt;If I comment-out all except the first occurrence, then the whole project compiles with no errors. &lt;/P&gt;
&lt;P&gt;Please can you make sense of this for me? I've tried using the recursive subroutine both within a module and outside a module, and it makes no difference. The subroutine is wholly self-contained and does not rely on any shared data (i.e. all the variables it needs are passed by reference through its arguments), so there's no actual need for it to be in a module. &lt;BR /&gt;&lt;/P&gt;</description>
    <pubDate>Sat, 29 Dec 2007 15:56:34 GMT</pubDate>
    <dc:creator>eos_pengwern</dc:creator>
    <dc:date>2007-12-29T15:56:34Z</dc:date>
    <item>
      <title>Recursive subroutine with multiple calls</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-subroutine-with-multiple-calls/m-p/872979#M72801</link>
      <description>&lt;P&gt;Hello, &lt;/P&gt;
&lt;P&gt;I have a recursive subroutine which is called from a 'main' program, and which within its own source code calls itself on four separate occasions.&lt;/P&gt;
&lt;P&gt;If I put the recursive subroutine into a project by itself, it compiles with no errors.&lt;/P&gt;
&lt;P&gt;If I put the recursive subroutine into the same project as the 'main' program, then during the compilation an error is flagged in the recursive subroutine's source code for the second, third and fourth occurrences of it calling itself. The error message is "The same named entity from different modules and/or program units cannot be referenced". No error message is given for the first occurrence.&lt;/P&gt;
&lt;P&gt;If I comment-out all except the first occurrence, then the whole project compiles with no errors. &lt;/P&gt;
&lt;P&gt;Please can you make sense of this for me? I've tried using the recursive subroutine both within a module and outside a module, and it makes no difference. The subroutine is wholly self-contained and does not rely on any shared data (i.e. all the variables it needs are passed by reference through its arguments), so there's no actual need for it to be in a module. &lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 29 Dec 2007 15:56:34 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-subroutine-with-multiple-calls/m-p/872979#M72801</guid>
      <dc:creator>eos_pengwern</dc:creator>
      <dc:date>2007-12-29T15:56:34Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive subroutine with multiple calls</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-subroutine-with-multiple-calls/m-p/872980#M72802</link>
      <description>If this happens with the current 10.1 compiler, with correct RECURSIVE syntax, please submit a problem report on premier.intel.com. Does it make a difference if you disable inter-procedural optimizations?&lt;BR /&gt;Such a report on this forum is more interesting if you give an actual example.&lt;BR /&gt;</description>
      <pubDate>Sat, 29 Dec 2007 16:29:41 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-subroutine-with-multiple-calls/m-p/872980#M72802</guid>
      <dc:creator>TimP</dc:creator>
      <dc:date>2007-12-29T16:29:41Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive subroutine with multiple calls</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-subroutine-with-multiple-calls/m-p/872981#M72803</link>
      <description>&lt;P&gt;Thank you Tim; I guess I wanted to check that this wasn't standard Fortran behavior (for some unexpected reason) before pointing the finger at the compiler.&lt;/P&gt;
&lt;P&gt;As it happens, I had been trying to compile in 'debug' mode, but your suggestion re. interprocedural optimizations made me wonder if this was in fact the problem. When I compiled the project in 'release' mode (using the default settings) it completed without error.&lt;/P&gt;
&lt;P&gt;So it looks like it is in fact a compiler problem (since I am indeed in V10.1), and I shall switch forums.&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 29 Dec 2007 17:49:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-subroutine-with-multiple-calls/m-p/872981#M72803</guid>
      <dc:creator>eos_pengwern</dc:creator>
      <dc:date>2007-12-29T17:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive subroutine with multiple calls</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-subroutine-with-multiple-calls/m-p/872982#M72804</link>
      <description>The message you're seeing is not related to optimization - it comes from the compiler's parsing and semantic analysis. The difference you're seeing between debug and release builds is that the debug build has interface generation and checking turned on and the release configuration does not.&lt;BR /&gt;&lt;BR /&gt;I've seen a bug related to this option with the symptom you report, but I can't say, without seeing your test case, if in fact it is a compiler bug. It may be your coding error that the compiler is correctly diagnosing with the additional information.&lt;BR /&gt;&lt;BR /&gt;Please submit an issue to Intel Premier Support and attach a ZIP of your project with sources so that we can take a look.&lt;BR /&gt;</description>
      <pubDate>Sat, 29 Dec 2007 19:48:58 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-subroutine-with-multiple-calls/m-p/872982#M72804</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2007-12-29T19:48:58Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive subroutine with multiple calls</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-subroutine-with-multiple-calls/m-p/872983#M72805</link>
      <description>&lt;P&gt;Thank you, I have done so. In fact, I've realized that when I successfully compiled the recursive subroutine in a project on its own, I must have overlooked the 'release' setting because that also does not work when in debug mode.&lt;/P&gt;
&lt;P&gt;In fact, I found that even the following trivial code will compile in release mode but not in debug mode (unless I comment out the additional calls):&lt;/P&gt;&lt;PRE&gt;&lt;B&gt;&lt;FONT color="#0000ff" size="2"&gt;&lt;P&gt;recursive&lt;/P&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; &lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff" size="2"&gt;subroutine&lt;/FONT&gt;&lt;/B&gt;&lt;FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; factorial(x,y)&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff" size="2"&gt;integer&lt;/FONT&gt;&lt;/B&gt;&lt;FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; :: x, y, z&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff" size="2"&gt;if&lt;/FONT&gt;&lt;/B&gt;&lt;FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; (x.le.1) &lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff" size="2"&gt;then&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;P&gt;    y=1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff" size="2"&gt;else&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff" size="2"&gt;    call&lt;/FONT&gt;&lt;/B&gt;&lt;FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; factorial(x-1,y)&lt;P&gt;&lt;/P&gt;&lt;P&gt;    y=y * x&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff" size="2"&gt;end if&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#008000" size="2"&gt;! Just for fun we'll call it a few more times, but do nothing with&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT color="#008000" size="2"&gt;! the results&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff" size="2"&gt;call&lt;/FONT&gt;&lt;/B&gt;&lt;FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; factorial(x-1,z)&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff" size="2"&gt;call&lt;/FONT&gt;&lt;/B&gt;&lt;FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; factorial(x-1,z)&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff" size="2"&gt;call&lt;/FONT&gt;&lt;/B&gt;&lt;FONT&gt;&lt;/FONT&gt;&lt;FONT size="2"&gt; factorial(x-1,z)&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;B&gt;&lt;FONT color="#0000ff" size="2"&gt;end&lt;P&gt;&lt;/P&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;FONT&gt;&lt;/FONT&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 29 Dec 2007 21:13:16 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-subroutine-with-multiple-calls/m-p/872983#M72805</guid>
      <dc:creator>eos_pengwern</dc:creator>
      <dc:date>2007-12-29T21:13:16Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive subroutine with multiple calls</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-subroutine-with-multiple-calls/m-p/872984#M72806</link>
      <description>It compiles fine for me - which compiler version do you have? Can you post the buildlog.htm from your Debug folder?&lt;BR /&gt;</description>
      <pubDate>Sun, 30 Dec 2007 00:02:04 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-subroutine-with-multiple-calls/m-p/872984#M72806</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2007-12-30T00:02:04Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive subroutine with multiple calls</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-subroutine-with-multiple-calls/m-p/872985#M72807</link>
      <description>&lt;P&gt;I'm using the latest, greatest V10.1.013; here's the contents of buildlog.htm:&lt;/P&gt;&lt;PRE&gt;&lt;PRE&gt;Compiling with Intel Fortran Compiler 10.1.013 [IA-32]...
ifort /nologo /Zi /Od /gen-interfaces /warn:interfaces /module:"Debug" /object:"Debug" /traceback /check:bounds /libs:dll /threads /dbglibs /c /Qvc8 /Qlocation,link,"C:Program FilesMicrosoft Visual Studio 8VC&amp;#8;in" "C:Documents and SettingsStephen J. MorrisMy DocumentsVisual Studio 2005ProjectsRecursionRecursionSource1.F90"
C:Documents and SettingsStephen J. MorrisMy DocumentsVisual Studio 2005ProjectsRecursionRecursionSource1.F90(15) : Error: The same named entity from different modules and/or program units cannot be referenced.   [FACTORIAL]
    call factorial(x-1,z)
---------^
C:Documents and SettingsStephen J. MorrisMy DocumentsVisual Studio 2005ProjectsRecursionRecursionSource1.F90(16) : Error: The same named entity from different modules and/or program units cannot be referenced.   [FACTORIAL]
    call factorial(x-1,z)
---------^
C:Documents and SettingsStephen J. MorrisMy DocumentsVisual Studio 2005ProjectsRecursionRecursionSource1.F90(17) : Error: The same named entity from different modules and/or program units cannot be referenced.   [FACTORIAL]
    call factorial(x-1,z)
---------^
compilation aborted for C:Documents and SettingsStephen J. MorrisMy DocumentsVisual Studio 2005ProjectsRecursionRecursionSource1.F90 (code 1)


Recursion - 4 error(s), 0 warning(s)

&lt;/PRE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 31 Dec 2007 09:57:14 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-subroutine-with-multiple-calls/m-p/872985#M72807</guid>
      <dc:creator>eos_pengwern</dc:creator>
      <dc:date>2007-12-31T09:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive subroutine with multiple calls</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-subroutine-with-multiple-calls/m-p/872986#M72808</link>
      <description>Ok, I see it now. This happens the &lt;B&gt;second &lt;/B&gt;time you compile it! It is a problem with the automatic interface checking - it should not check for a generated interface for a call to the containing routine.&lt;BR /&gt;&lt;BR /&gt;I will pass this on to the developers. You can turn off "Check routine interfaces" in the Diagnostics property page if you want to avoid the problem.&lt;BR /&gt;</description>
      <pubDate>Mon, 31 Dec 2007 14:37:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-subroutine-with-multiple-calls/m-p/872986#M72808</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2007-12-31T14:37:03Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive subroutine with multiple calls</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-subroutine-with-multiple-calls/m-p/872987#M72809</link>
      <description>Hmm, it's more complicated than that - the first call is ok, but the three extras are flagged. What the difference is, I don't know...&lt;BR /&gt;</description>
      <pubDate>Mon, 31 Dec 2007 14:40:51 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-subroutine-with-multiple-calls/m-p/872987#M72809</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2007-12-31T14:40:51Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive subroutine with multiple calls</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-subroutine-with-multiple-calls/m-p/872988#M72810</link>
      <description>If you submit an issue on this to Intel Premier Support, please reference T82170-CP.&lt;BR /&gt;</description>
      <pubDate>Mon, 31 Dec 2007 15:00:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-subroutine-with-multiple-calls/m-p/872988#M72810</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2007-12-31T15:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: Recursive subroutine with multiple calls</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-subroutine-with-multiple-calls/m-p/872989#M72811</link>
      <description>&lt;P&gt;I've already submitted it, but I'll notify the person dealing with it of the reference.&lt;/P&gt;
&lt;P&gt;Thanks very much.&lt;/P&gt;</description>
      <pubDate>Mon, 31 Dec 2007 15:16:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Recursive-subroutine-with-multiple-calls/m-p/872989#M72811</guid>
      <dc:creator>eos_pengwern</dc:creator>
      <dc:date>2007-12-31T15:16:24Z</dc:date>
    </item>
  </channel>
</rss>

