Showing results for 
Search instead for 
Did you mean: 
1 View

Array notation error in debug mode?

I'm getting some weird runtime errors in debug mode after I updated to Visual Studio 2017.  Below is some test code that causes the issue in debug mode, but is fine in release mode.  The second write statement should produce the same results as the first write statement, but in debug mode it generates a runtime error.

program testing

   implicit none
   real :: angle(8)
   angle = [1.,2.,3.,4.,5.,6.,7.,8.]
   write(6,'(4(f5.3, 1x))') angle(2), angle(3), angle(7), angle(1)
   write(6,'(4(f5.3, 1x))') angle([2,3,7,1])

end program testing

I am using the default settings for the compiler.

Intel® Parallel Studio XE 2017 Update 2 Composer Edition for Fortran Windows*   Package ID: w_comp_lib_2017.2.187
Intel® Parallel Studio XE 2017 Update 2 Composer Edition for Fortran Windows* Integration for Microsoft Visual Studio* 2013, Version 17.0.0041.12,

0 Kudos
3 Replies
Black Belt
1 View

Compilint with /check:bo

Compiling with /check:bounds and running gives

2.000 3.000 7.000 1.000
forrtl: severe (408): fort: (2): Subscript #1 of the array ANGLE has value 1090519040 which is greater than the upper bound of 8

Image              PC        Routine            Line        Source
libifcoremd.dll    5DCF3F48  Unknown               Unknown  Unknown
sk.exe             012A1104  _MAIN__                    10  sk.f90
sk.exe             012A2F4F  Unknown               Unknown  Unknown

with the 32-bit or 64-bit EXE produced. This appears to be another example where the program is simple and runs fine without any bounds checking, but compiling with /check:bounds produces a false bounds violation message.

The reported subscript value, 1090519040, is Z'41000000'; could that be the string 'A', misplaced?

0 Kudos
1 View

This appears to be a

This appears to be a regression with the 17.0 compiler. The code behaves w/bounds-checking enabled with the 16.0 compiler. I reported it to Development.

(Internal tracking id: CMPLRS-42806)

0 Kudos
1 View

I confirmed this issue is

I confirmed this issue is fixed in our next PSXE 2017 Update 4 release that is due out shortly.

0 Kudos