<?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 Updating from V12.x may not in Intel® Fortran Compiler</title>
    <link>https://community.intel.com/t5/Intel-Fortran-Compiler/array-subscript-violation/m-p/1165646#M144254</link>
    <description>&lt;P&gt;Updating from V12.x may not be possible for youu.&lt;/P&gt;

&lt;P&gt;In your sample code, the size of the array dataPerAxis is quite small, and can be indexed with standard INTEGER indexes. Your axisDataPointerIntervaID and axisIntervalIds are INTEGER(8) arrays. Some of the older compilers had issues with indexing an array with an integer type that was not the integer type used for allocation/declaration. With this in mind either:&lt;/P&gt;

&lt;P&gt;a) Define axisDataPointerIntervaID and axisIntervalIds as INTEGER(4) arrays&lt;BR /&gt;
	or&lt;BR /&gt;
	b) Allocate/define dataPerAxis array using INTEGER(8) values (or literals)&lt;/P&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
    <pubDate>Tue, 10 Apr 2018 12:39:56 GMT</pubDate>
    <dc:creator>jimdempseyatthecove</dc:creator>
    <dc:date>2018-04-10T12:39:56Z</dc:date>
    <item>
      <title>array subscript violation</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/array-subscript-violation/m-p/1165639#M144247</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I’m getting an error, which is really strange and i don’t understand why.&lt;BR /&gt;
	I have attached a reduced version, so that only the relevant code lines are included. I have also attached a screenshot of the error message.&lt;/P&gt;

&lt;P&gt;&lt;BR /&gt;
	I’m using the intel fortran compiler: 12.1.4.325 Build 20120410 with the Microsoft visual studio 2010.&lt;BR /&gt;
	The compile flags: ifort /debug:full /Zi /Od /traceback /free /w /check:all MultivariateInterpolatorIDW.for&lt;/P&gt;

&lt;P&gt;I have found some modifications, which don’t cause an error, but it makes no sense to me, that the attached one is not working. I hope someone can explain it to me. Do i violate a fortran specification without knowing? T&lt;SPAN class="hs_cos_wrapper hs_cos_wrapper_meta_field hs_cos_wrapper_type_rich_text" data-hs-cos-general-type="meta_field" data-hs-cos-type="rich_text" id="hs_cos_wrapper_post_body" style=""&gt;hank you for reading.&lt;/SPAN&gt;&lt;/P&gt;

&lt;P&gt;&lt;BR /&gt;
	Modification which are fine&lt;BR /&gt;
	delete the keyword: target&lt;BR /&gt;
	&lt;STRONG&gt;OR&lt;/STRONG&gt;&lt;BR /&gt;
	Change&lt;BR /&gt;
	integer( kind=i18 ), intent&lt;STRONG&gt;(inout)&lt;/STRONG&gt;, target :: axisIntervalIds(:)&amp;nbsp; to&lt;BR /&gt;
	integer( kind=i18 ), intent&lt;STRONG&gt;(in)&lt;/STRONG&gt;, target :: axisIntervalIds(:)&lt;BR /&gt;
	&lt;STRONG&gt;OR&lt;/STRONG&gt;&lt;BR /&gt;
	Change&lt;BR /&gt;
	integer( kind=i18 ), intent(in) :: axisDataPointIntervalId&lt;STRONG&gt;(:)&lt;/STRONG&gt; to&lt;BR /&gt;
	integer( kind=i18 ), intent(in) :: axisDataPointIntervalId&lt;STRONG&gt;(12)&lt;/STRONG&gt;&lt;BR /&gt;
	&lt;STRONG&gt;OR&lt;/STRONG&gt;&lt;BR /&gt;
	Change the line to&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;&lt;STRONG&gt;weights( 1:12:2 ) = dataPerAxis( axisDataPointIntervalId( 1:12:2 ) - 1 + axisIntervalIds( 2:12:2 ) ) to&lt;/STRONG&gt;&lt;/PRE&gt;

&lt;P&gt;test(:) = axisDataPointIntervalId( 1:12:2 ) - 1 + axisIntervalIds( 2:12:2 )&lt;BR /&gt;
	weights( 1:12:2 ) = dataPerAxis(test)&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="bug.png"&gt;&lt;img src="https://community.intel.com/t5/image/serverpage/image-id/9885i5DEBB0ADCCBCAC30/image-size/large?v=v2&amp;amp;px=999&amp;amp;whitelist-exif-data=Orientation%2CResolution%2COriginalDefaultFinalSize%2CCopyright" role="button" title="bug.png" alt="bug.png" /&gt;&lt;/span&gt;&lt;/PRE&gt;

&lt;PRE class="brush:fortran;"&gt;      module MultivariateInterpolatorIDW

        implicit none
        private

        integer, parameter :: r15 = SELECTED_REAL_KIND( 15, 307 )
        integer, parameter :: i18 = SELECTED_INT_KIND( 18 )

        public :: MVI_interpolate

      contains

        subroutine MVI_interpolate()

          real( kind=r15 ) :: interpolatedValueV(1)
! local
          real( kind=r15 ) :: dataPerAxis(12)
          integer( kind=i18 ) :: axisDataPointIntervalId(12)
          integer( kind=i18 ), target :: axisIntervalIds(12)


          dataPerAxis(:) = 10
          axisDataPointIntervalId( : ) = 1
          axisIntervalIds(:) = 1

            interpolatedValueV( 1 ) = MVI_interpolateSub( dataPerAxis, axisDataPointIntervalId, axisIntervalIds )

        end subroutine


        function MVI_interpolateSub( dataPerAxis, axisDataPointIntervalId, axisIntervalIds )

! in
          real( kind=r15 ), intent(in) :: dataPerAxis(12)
          integer( kind=i18 ), intent(in) :: axisDataPointIntervalId(:)
! inout
          integer( kind=i18 ), intent(inout), target :: axisIntervalIds(:)
! return
          real( kind=r15 ) :: MVI_interpolateSub
! local
          real( kind=r15 ) :: weights(12)

&lt;STRONG&gt;          weights( 1:12:2 ) = dataPerAxis( axisDataPointIntervalId( 1:12:2 ) - 1 + axisIntervalIds( 2:12:2 ) )&lt;/STRONG&gt;

           MVI_interpolateSub = 0.0

        end function

      end module

      program main

        use MultivariateInterpolatorIDW

        implicit none

        call MVI_interpolate( )

      end program&lt;/PRE&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2018 13:50:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/array-subscript-violation/m-p/1165639#M144247</guid>
      <dc:creator>Rabindran</dc:creator>
      <dc:date>2018-04-06T13:50:00Z</dc:date>
    </item>
    <item>
      <title>I have tried compiling your</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/array-subscript-violation/m-p/1165640#M144248</link>
      <description>&lt;P&gt;I have tried compiling your program with Intel(R) Visual Fortran Compiler 18.0.2.185&amp;nbsp; and with&amp;nbsp; gfortran (5.4.0) .&amp;nbsp; In both cases it ran without crashing.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 06 Apr 2018 19:10:40 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/array-subscript-violation/m-p/1165640#M144248</guid>
      <dc:creator>Roman1</dc:creator>
      <dc:date>2018-04-06T19:10:40Z</dc:date>
    </item>
    <item>
      <title>I interpreted the identified</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/array-subscript-violation/m-p/1165641#M144249</link>
      <description>&lt;P&gt;I interpreted the identified line as:&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; weights( 1:12:2 ) = dataPerAxis( axisDataPointIntervalId( 1:12:2 ) - 1 + axisIntervalIds( 2:12:2 ) ) ! ###
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; write (*,*) 'weights :',weights

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; write (*,*) ' '
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; write (*,*) 'weights :'
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; do k = 1,12,2
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; kk = axisDataPointIntervalId( k ) - 1 + axisIntervalIds( k+1 )
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; weights(k) = dataPerAxis( kk ) ! ###
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; write (*,*) k,kk, weights(k)
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end do
&lt;/PRE&gt;

&lt;P&gt;I may have it wrong, but is that what you intended ?&lt;/P&gt;</description>
      <pubDate>Sat, 07 Apr 2018 03:26:53 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/array-subscript-violation/m-p/1165641#M144249</guid>
      <dc:creator>John_Campbell</dc:creator>
      <dc:date>2018-04-07T03:26:53Z</dc:date>
    </item>
    <item>
      <title>The compiler may have a</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/array-subscript-violation/m-p/1165642#M144250</link>
      <description>&lt;P&gt;The compiler may have a question as to how to handle the scalar (which may or may not be a bug). Try&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;weights( 1:12:2 ) = dataPerAxis( (axisDataPointIntervalId( 1:12:2 ) - 1) + axisIntervalIds( 2:12:2 ) )
or
weights( 1:12:2 ) = dataPerAxis( (axisDataPointIntervalId( 1:12:2 ) - 1_i18) + axisIntervalIds( 2:12:2 ) )&lt;/PRE&gt;

&lt;P&gt;If you continue to get the error, add a diagnostic print in front of the above line&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;print *,axisDataPointIntervalId( 1:12:2 )
print *,axisIntervalIds( 2:12:2 )
print *,axisDataPointIntervalId( 1:12:2 ) - 1 + axisIntervalIds( 2:12:2 )&lt;/PRE&gt;

&lt;P&gt;All three must produce a valid index into dataPerAxis (a value between 1:12, for use as an index into dataPerAxis)&lt;/P&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Sat, 07 Apr 2018 15:14:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/array-subscript-violation/m-p/1165642#M144250</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2018-04-07T15:14:00Z</dc:date>
    </item>
    <item>
      <title>Hello,</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/array-subscript-violation/m-p/1165643#M144251</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;thanks for the replys.&lt;/P&gt;

&lt;P&gt;@Roman: i have the feeling, it could be an bug with the older version. Unfortunately I have no access to a newer one, but I will try it out, if possible.&lt;/P&gt;

&lt;P&gt;@John Campbell: You have identified the line correct. Your disassembled code is working, because it is the same way like storing the index into an array, before using. Actually it should make no difference from my point of view.&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;test(:) = axisDataPointIntervalId( 1:12:2 ) - 1 + axisIntervalIds( 2:12:2 )
weights( 1:12:2 ) = dataPerAxis(test)&lt;/PRE&gt;

&lt;P&gt;@Jim Dempsey: I tried both methods, unfortunately they don’t work. The printed index is always “1” for every three print cases.&lt;/P&gt;

&lt;P&gt;&amp;nbsp;&lt;/P&gt;

&lt;P&gt;I have the feeling, it could be an bug. I added this line&lt;/P&gt;

&lt;PRE class="brush:fortran;"&gt;          weights( 2:12:2 ) = dataPerAxis( axisDataPointIntervalId( 1:12:2 ) - 1 + axisIntervalIds( 1:12:2 ) )    &lt;/PRE&gt;

&lt;P&gt;before the critical one. It doesn’t cause an error, but the following one, which is strange to me.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Apr 2018 09:13:00 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/array-subscript-violation/m-p/1165643#M144251</guid>
      <dc:creator>Rabindran</dc:creator>
      <dc:date>2018-04-09T09:13:00Z</dc:date>
    </item>
    <item>
      <title>It is clearly a compiler bug.</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/array-subscript-violation/m-p/1165644#M144252</link>
      <description>&lt;P&gt;It is clearly a compiler bug. 12.x is very very old, the bug does not exist in current version!&lt;/P&gt;

&lt;P&gt;&lt;SPAN style="font-size: 1em;"&gt;I would not spend any time thinking about this!&amp;nbsp; &lt;/SPAN&gt;&lt;SPAN style="font-size: 1em;"&gt;Either use a newer compiler or apply one of the many workarounds you already know.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Apr 2018 10:35:46 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/array-subscript-violation/m-p/1165644#M144252</guid>
      <dc:creator>andrew_4619</dc:creator>
      <dc:date>2018-04-09T10:35:46Z</dc:date>
    </item>
    <item>
      <title>thanks for the replys. i will</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/array-subscript-violation/m-p/1165645#M144253</link>
      <description>&lt;P&gt;thanks for the replys. i will try to get my hands on a newer version.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2018 08:43:03 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/array-subscript-violation/m-p/1165645#M144253</guid>
      <dc:creator>Rabindran</dc:creator>
      <dc:date>2018-04-10T08:43:03Z</dc:date>
    </item>
    <item>
      <title>Updating from V12.x may not</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/array-subscript-violation/m-p/1165646#M144254</link>
      <description>&lt;P&gt;Updating from V12.x may not be possible for youu.&lt;/P&gt;

&lt;P&gt;In your sample code, the size of the array dataPerAxis is quite small, and can be indexed with standard INTEGER indexes. Your axisDataPointerIntervaID and axisIntervalIds are INTEGER(8) arrays. Some of the older compilers had issues with indexing an array with an integer type that was not the integer type used for allocation/declaration. With this in mind either:&lt;/P&gt;

&lt;P&gt;a) Define axisDataPointerIntervaID and axisIntervalIds as INTEGER(4) arrays&lt;BR /&gt;
	or&lt;BR /&gt;
	b) Allocate/define dataPerAxis array using INTEGER(8) values (or literals)&lt;/P&gt;

&lt;P&gt;Jim Dempsey&lt;/P&gt;</description>
      <pubDate>Tue, 10 Apr 2018 12:39:56 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/array-subscript-violation/m-p/1165646#M144254</guid>
      <dc:creator>jimdempseyatthecove</dc:creator>
      <dc:date>2018-04-10T12:39:56Z</dc:date>
    </item>
    <item>
      <title>@Jim Dempsey: thank you for</title>
      <link>https://community.intel.com/t5/Intel-Fortran-Compiler/array-subscript-violation/m-p/1165647#M144255</link>
      <description>&lt;P&gt;@Jim Dempsey: thank you for you suggestion. Unfortunately it didn’t work. I will try my luck with a newer version.&lt;/P&gt;

&lt;P&gt;Is is possible to close this thread?&lt;/P&gt;</description>
      <pubDate>Wed, 11 Apr 2018 08:29:01 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Fortran-Compiler/array-subscript-violation/m-p/1165647#M144255</guid>
      <dc:creator>Rabindran</dc:creator>
      <dc:date>2018-04-11T08:29:01Z</dc:date>
    </item>
  </channel>
</rss>

