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,
链接已复制
3 回复数
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?