<?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 That is not a &amp;quot;bug&amp;quot;.  The a in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/detect-bad-array-shape/m-p/1080271#M121738</link>
    <description>&lt;P&gt;That is not a "bug". &amp;nbsp;The a array's first two entries are being set to the values in the b array. &amp;nbsp;As should be expected, the third entry is not initialized. &amp;nbsp;Therefore, it has a value that cannot be predicted. &amp;nbsp;About the only thing you can do here is have the compiler initialize the array.&lt;/P&gt;</description>
    <pubDate>Mon, 23 Nov 2015 20:47:38 GMT</pubDate>
    <dc:creator>NotThatItMatters</dc:creator>
    <dc:date>2015-11-23T20:47:38Z</dc:date>
    <item>
      <title>detect bad array shape</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/detect-bad-array-shape/m-p/1080270#M121737</link>
      <description>&lt;P&gt;The following program has a bug.&amp;nbsp; Do you know if it is possible to have the compiler detect it?&amp;nbsp; I have tried the following options without success:&lt;/P&gt;

&lt;P&gt;/Qtrapuv /Qinit:snan /Qinit:arrays /fpe:0&amp;nbsp; &amp;nbsp;/check:all&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;program test_shape
implicit none

real,allocatable,dimension(:):: a, b 
real c

allocate( a(5), b(2) )

b = 0.0
a = b   !!!

c = a(3)
print*, c  ! output: -4.3160208E+08  ???
stop
end program test_shape

&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2015 20:37:29 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/detect-bad-array-shape/m-p/1080270#M121737</guid>
      <dc:creator>Roman1</dc:creator>
      <dc:date>2015-11-23T20:37:29Z</dc:date>
    </item>
    <item>
      <title>That is not a "bug".  The a</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/detect-bad-array-shape/m-p/1080271#M121738</link>
      <description>&lt;P&gt;That is not a "bug". &amp;nbsp;The a array's first two entries are being set to the values in the b array. &amp;nbsp;As should be expected, the third entry is not initialized. &amp;nbsp;Therefore, it has a value that cannot be predicted. &amp;nbsp;About the only thing you can do here is have the compiler initialize the array.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2015 20:47:38 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/detect-bad-array-shape/m-p/1080271#M121738</guid>
      <dc:creator>NotThatItMatters</dc:creator>
      <dc:date>2015-11-23T20:47:38Z</dc:date>
    </item>
    <item>
      <title>Are you aware of /assume</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/detect-bad-array-shape/m-p/1080272#M121739</link>
      <description>&lt;P&gt;Are you aware of /assume:realloc_lhs and/or /standard-semantics compiler options and the role they play with treating allocatable objects?&lt;/P&gt;

&lt;P&gt;&lt;A href="https://software.intel.com/en-us/node/579519" target="_blank"&gt;https://software.intel.com/en-us/node/579519&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="https://software.intel.com/en-us/node/579529" target="_blank"&gt;https://software.intel.com/en-us/node/579529&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;You'll notice per standard Fortran i.e., starting with Fortran 2003, SIZE(a) should be 2 following the assignment on line #10, not 5 as allocated on line #7. &amp;nbsp;But if I'm not mistaken, standard Fortran rules for allocatable object assignment, etc. are still not implemented by default in Intel Fortran, rather one has to turn them on using /standard-semantics, etc. &amp;nbsp;So you may want to look into this aspect and whether you are making use of it; if not, see if you can and should.&lt;/P&gt;

&lt;P&gt;Now if you go with standard Fortran rules for reallocation, you can look into /check:bounds compiler option which can trigger a run-time check when line 12 is executed since it should involve accessing an element outside the bounds, something worth doing with tests on your code run in Debug configuration:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://software.intel.com/en-us/node/579521" target="_blank"&gt;https://software.intel.com/en-us/node/579521&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Otherwise, look into /check:uninit and /check:pointers and whether they can help you, at least at run-time if not at compile-time.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2015 21:18:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/detect-bad-array-shape/m-p/1080272#M121739</guid>
      <dc:creator>FortranFan</dc:creator>
      <dc:date>2015-11-23T21:18:00Z</dc:date>
    </item>
    <item>
      <title> </title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/detect-bad-array-shape/m-p/1080273#M121740</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;Thanks for the information!&amp;nbsp; Initially, I was hoping that since I used&amp;nbsp; /Qinit:snan /Qinit:arrays , the value of c would be set to NaN, instead of -4.3160208E+08 .&amp;nbsp; The /assume:realloc_lhs&amp;nbsp; option was helpful.&lt;/P&gt;

&lt;P&gt;&lt;BR /&gt;
	&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2015 21:47:24 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/detect-bad-array-shape/m-p/1080273#M121740</guid>
      <dc:creator>Roman1</dc:creator>
      <dc:date>2015-11-23T21:47:24Z</dc:date>
    </item>
  </channel>
</rss>

