<?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 What happens if you use in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029557#M110223</link>
    <description>&lt;P&gt;What happens if you use&lt;/P&gt;
&lt;P&gt;INTEGER X(:)&lt;/P&gt;
&lt;P&gt;in the subroutine?&amp;nbsp; I believe this behaves differently to the older way you have declared it.&lt;/P&gt;
&lt;P&gt;David&lt;/P&gt;</description>
    <pubDate>Mon, 20 Oct 2014 00:04:00 GMT</pubDate>
    <dc:creator>DavidWhite</dc:creator>
    <dc:date>2014-10-20T00:04:00Z</dc:date>
    <item>
      <title>Q about passing array boundaries or sizes</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029556#M110222</link>
      <description>&lt;P&gt;Suppose I have this:&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;integer x(100)&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;call xprint(x(23:70) )&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;end&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;subroutine xprint(x)&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;integer x(*)&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;end subroutine&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Normally I would have to ALSO tell it how many elements of X to print.&lt;/P&gt;

&lt;P&gt;But I was wondering if there is a subroutine call that would actually tell me &lt;STRONG&gt;how many elements&lt;/STRONG&gt; I am passing?&lt;/P&gt;

&lt;P&gt;UBOUND and SIZEOF do not work here. I get a compiler error.&lt;/P&gt;

&lt;P&gt;If I tell the internal subroutine a fixed number of elements, x(1:20) for example,&lt;/P&gt;

&lt;P&gt;then it will use that number, and does not know any thing about the actual size passed to it.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Maybe that is a future enhancement?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 19 Oct 2014 21:52:26 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029556#M110222</guid>
      <dc:creator>WSinc</dc:creator>
      <dc:date>2014-10-19T21:52:26Z</dc:date>
    </item>
    <item>
      <title>What happens if you use</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029557#M110223</link>
      <description>&lt;P&gt;What happens if you use&lt;/P&gt;
&lt;P&gt;INTEGER X(:)&lt;/P&gt;
&lt;P&gt;in the subroutine?&amp;nbsp; I believe this behaves differently to the older way you have declared it.&lt;/P&gt;
&lt;P&gt;David&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2014 00:04:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029557#M110223</guid>
      <dc:creator>DavidWhite</dc:creator>
      <dc:date>2014-10-20T00:04:00Z</dc:date>
    </item>
    <item>
      <title>Fortran 90 introduced the</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029558#M110224</link>
      <description>&lt;P&gt;Fortran 90 introduced the concept of assumed shape.&amp;nbsp; If your subroutine xprint has an explicit interface (perhaps because it is in a module), then you could use an assumed shape declaration (see the colon in the array specification in the following example) for the array argument - and then the compiler will automatically arrange for the shape of the actual argument to be accessible via the dummy argument&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;SUBROUTINE xprint(x)
  INTEGER :: x(:)
  PRINT "('The size of x is ',I0)", SIZE(x)
END SUBROUTINE xprint&lt;/PRE&gt;

&lt;P&gt;Note that "assumed shape" does not mean "assumed bounds" - for the call in your example the lower bound of the dummy argument x in the above will be 1 (you can specify a different lower bound to use if you want) and the upper bound will be 48.&lt;/P&gt;

&lt;P&gt;In your original example you used an assumed size argument, with the * array specifier.&amp;nbsp; Unlike assumed shape, for an assumed size argument the compiler does not automatically arrange for that size information to be accessible via the dummy argument, hence you can't do operations on that array that implicitly require that size.&amp;nbsp; The programmer needs to arrange for that size information to be explicitly communicated in some other way.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2014 00:04:30 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029558#M110224</guid>
      <dc:creator>IanH</dc:creator>
      <dc:date>2014-10-20T00:04:30Z</dc:date>
    </item>
    <item>
      <title>Well, I tried it, but then I</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029559#M110225</link>
      <description>&lt;P&gt;Well, I tried it, but then I get this ERROR 7978&lt;/P&gt;

&lt;P&gt;"Interface missing from source file"&lt;/P&gt;

&lt;P&gt;error #7978: Required interface for passing assumed shape array is missing from original source &amp;nbsp; &lt;X&gt;&lt;BR /&gt;
	compilation aborted for C:\Users\billsincl\Downloads\test45_0 (1).f90 (code 1)&lt;/X&gt;&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Why would having it in the MAIN program make any difference?&lt;/P&gt;

&lt;P&gt;It works when the CALLING program is in a subroutine.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2014 00:24:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029559#M110225</guid>
      <dc:creator>WSinc</dc:creator>
      <dc:date>2014-10-20T00:24:00Z</dc:date>
    </item>
    <item>
      <title>You can add an interface to</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029560#M110226</link>
      <description>&lt;P&gt;You can add an interface to your program as attached.&lt;/P&gt;
&lt;P&gt;or put CONTAINS before the subroutine and the END for the program after the end of the subroutine (makes it internal to the program).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2014 00:39:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029560#M110226</guid>
      <dc:creator>DavidWhite</dc:creator>
      <dc:date>2014-10-20T00:39:03Z</dc:date>
    </item>
    <item>
      <title>...or put it in a module.
	 </title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029561#M110227</link>
      <description>&lt;P&gt;...or put it in a module.&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2014 00:44:45 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029561#M110227</guid>
      <dc:creator>IanH</dc:creator>
      <dc:date>2014-10-20T00:44:45Z</dc:date>
    </item>
    <item>
      <title>Put the SUBROUTINE in a</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029562#M110228</link>
      <description>&lt;P&gt;Put the SUBROUTINE in a module?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Well, I will try that - but does the compiler REQUIRE that specifically?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2014 00:47:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029562#M110228</guid>
      <dc:creator>WSinc</dc:creator>
      <dc:date>2014-10-20T00:47:18Z</dc:date>
    </item>
    <item>
      <title>Either you put the subroutine</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029563#M110229</link>
      <description>&lt;P&gt;Either you put the subroutine into a module, which is then used by the main program (which then knows the interface for the subroutine), or you explicitly provide the interface information as I did in my example.&amp;nbsp; Both ultimately provide the main program with the details of the arguments that the subroutine expects, and so eliminates the error that you reported that the interface was missing.&lt;/P&gt;
&lt;P&gt;David&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2014 00:57:12 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029563#M110229</guid>
      <dc:creator>DavidWhite</dc:creator>
      <dc:date>2014-10-20T00:57:12Z</dc:date>
    </item>
    <item>
      <title>Can you give me an example of</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029564#M110230</link>
      <description>&lt;P&gt;Can you give me an example of how you did that?&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Just stuffing the whole subroutine into a MODULE generated BOUCOUP error messages.&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2014 01:04:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029564#M110230</guid>
      <dc:creator>WSinc</dc:creator>
      <dc:date>2014-10-20T01:04:18Z</dc:date>
    </item>
    <item>
      <title>module mod001</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029565#M110231</link>
      <description>&lt;PRE class="brush:fortran;"&gt;    module mod001
    CONTAINS   ! &amp;lt;-----
    subroutine xprint(x)
    integer :: x(:)
    nx=size(x)
    print *,"nx=",nx
    end subroutine
    end module
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2014 02:10:18 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029565#M110231</guid>
      <dc:creator>IanH</dc:creator>
      <dc:date>2014-10-20T02:10:18Z</dc:date>
    </item>
    <item>
      <title>billsincl,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029566#M110232</link>
      <description>&lt;P&gt;billsincl,&lt;/P&gt;

&lt;P&gt;I think I've suggested this to you before, please take the time to study the books recommended by Dr Fortran in his blog at&amp;nbsp;https://software.intel.com/en-us/blogs/2013/12/30/doctor-fortran-in-its-a-modern-fortran-world. &amp;nbsp;I feel in spite of the best intentions of good, honest folks providing earnest responses to inquiries, the comments in this forum should be viewed more as supplemental material rather than as a primary learning source. &amp;nbsp;You'd do yourself a great favor if you can take the time to review the material on Fortran 90 onwards in detail. &amp;nbsp;As you know, you'll then be reminded of the power and flexibility of assumed shape arrays:&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;MODULE m

   IMPLICIT NONE
   PRIVATE

   PUBLIC :: xprint

CONTAINS

   SUBROUTINE xprint(x, lb)

      !.. Argument list
      INTEGER, INTENT(IN) :: lb
      INTEGER, INTENT(IN) :: x(lb:)

      !..
      PRINT *," Size of x: ",        SIZE(x)
      PRINT *," Lower bound of x: ", LBOUND(x)
      PRINT *," Upper bound of x: ", UBOUND(x)

      !..
      RETURN

   END SUBROUTINE

END MODULE m
PROGRAM p

    USE m, ONLY : xprint

    IMPLICIT NONE

    INTEGER, PARAMETER :: LL = -10
    INTEGER, PARAMETER :: EXT = 99
    INTEGER :: x(LL:LL+EXT)
    INTEGER :: Id

    Id = 12
    CALL xprint(x(Id:Id+47), Id)

    STOP

END PROGRAM p
&lt;/PRE&gt;

&lt;PRE class="brush:plain;"&gt;  Size of x:           48
  Lower bound of x:           12
  Upper bound of x:           59
&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2014 03:38:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029566#M110232</guid>
      <dc:creator>FortranFan</dc:creator>
      <dc:date>2014-10-20T03:38:00Z</dc:date>
    </item>
    <item>
      <title>OH sure, I am aware of the</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029567#M110233</link>
      <description>&lt;P&gt;OH sure, I am aware of the textbooks - -&lt;/P&gt;

&lt;P&gt;Its just getting hold of of them, and gleaning out the relevant info thats tricky.&lt;/P&gt;

&lt;P&gt;Sometimes they dont give you very direct answers, that why I have to resort to this forum.&lt;/P&gt;

&lt;P&gt;I would take a &lt;STRONG&gt;college course&lt;/STRONG&gt; if one was available in these parts.&lt;/P&gt;

&lt;P&gt;Thanks for your input ! !&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2014 14:53:20 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029567#M110233</guid>
      <dc:creator>WSinc</dc:creator>
      <dc:date>2014-10-20T14:53:20Z</dc:date>
    </item>
    <item>
      <title>Take a look at Doctor Fortran</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029568#M110234</link>
      <description>&lt;P&gt;Take a look at &lt;A href="http://software.intel.com/en-us/forums/topic/275071#comment-1548440"&gt;Doctor Fortran Gets Explicit!&lt;/A&gt; and &lt;A href="http://software.intel.com/en-us/blogs/2012/01/05/doctor-fortran-gets-explicit-again/"&gt;Doctor Fortran Gets Explicit - Again!&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2014 14:57:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029568#M110234</guid>
      <dc:creator>Steven_L_Intel1</dc:creator>
      <dc:date>2014-10-20T14:57:00Z</dc:date>
    </item>
    <item>
      <title>I will certainly study that.</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029569#M110235</link>
      <description>&lt;P&gt;I will certainly study that.&lt;/P&gt;

&lt;P&gt;Much more informative than the textbooks I have looked at.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2014 15:03:28 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029569#M110235</guid>
      <dc:creator>WSinc</dc:creator>
      <dc:date>2014-10-20T15:03:28Z</dc:date>
    </item>
    <item>
      <title>Bill,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029570#M110236</link>
      <description>&lt;P&gt;Bill,&lt;/P&gt;

&lt;P&gt;There are limits to how effective the&amp;nbsp;(:) array syntax is, as the following example shows that the convenience of F90 style array size info is limited only to the size and not the section information.&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;module info
&amp;nbsp; contains
&amp;nbsp; subroutine xprint(x)
&amp;nbsp;&amp;nbsp;&amp;nbsp; integer x(:)
&amp;nbsp;&amp;nbsp;&amp;nbsp; PRINT *," Size of x: ",&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SIZE(x)
&amp;nbsp;&amp;nbsp;&amp;nbsp; PRINT *," Lower bound of x: ", LBOUND(x)
&amp;nbsp;&amp;nbsp;&amp;nbsp; PRINT *," Upper bound of x: ", UBOUND(x)
&amp;nbsp; end subroutine xprint
end module info

use info
&amp;nbsp; integer x(100)

&amp;nbsp; call xprint(x(23:70) )

end&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 20 Oct 2014 21:54:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029570#M110236</guid>
      <dc:creator>John_Campbell</dc:creator>
      <dc:date>2014-10-20T21:54:38Z</dc:date>
    </item>
    <item>
      <title>OK, I will try both</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029571#M110237</link>
      <description>&lt;P&gt;OK, I will try both approaches.&lt;/P&gt;

&lt;P&gt;It does not seems obvious to me right offhand which is better.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thanks for your feedback !&lt;/P&gt;</description>
      <pubDate>Tue, 21 Oct 2014 06:30:05 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029571#M110237</guid>
      <dc:creator>WSinc</dc:creator>
      <dc:date>2014-10-21T06:30:05Z</dc:date>
    </item>
    <item>
      <title>Quote:billsincl wrote:</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029572#M110238</link>
      <description>&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE&gt;billsincl wrote:&lt;BR /&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;OK, I will try both approaches.&lt;/P&gt;

&lt;P&gt;It does not seems obvious to me right offhand which is better.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thanks for your feedback !&lt;/P&gt;

&lt;P&gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;

&lt;P&gt;Again, my message can be summed up in 3 words: details, details, details! &amp;nbsp;I deliberately didn't point our particular details in my example in Quote #11 in order to encourage Bill and others to look them up from better sources such as Dr Fortran blog, books recommended therein, and technical papers, etc.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Oct 2014 13:57:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/Q-about-passing-array-boundaries-or-sizes/m-p/1029572#M110238</guid>
      <dc:creator>FortranFan</dc:creator>
      <dc:date>2014-10-21T13:57:03Z</dc:date>
    </item>
  </channel>
</rss>

