Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
29277 Discussions

Array bounds check in debug mode 11.1.065

stephh
Beginner
851 Views

Hi

The following code is compiled with ifort 11.1.065 using the /check:bounds option:

REAL*4 D_DIST(2,2)

i = 21

D_DIST(i,1) = 0.0

When running in VS 2008, with allexceptions turned on,in debug mode no exception is generated.

Funny thing is that a run-time error will occur when compiled/run with ifort 10.1.013/VS 2005.

Any clues as to why the difference in behavior?

Thanks

Steph

0 Kudos
3 Replies
Steven_L_Intel1
Employee
851 Views
Is that the complete program, other than the missing END? What is the full set of compilation options used? I get the proper error when I try it.
0 Kudos
Steven_Salata
Beginner
851 Views
I've seen the same issue when stepping through code using Visual Studio 2008 9.0.30729.1.

I've taken those three lines and added them to the attached CopyFolder example. I get no errors when stepping through the code.

Steve
0 Kudos
Steven_L_Intel1
Employee
851 Views
I get an error when I step through the code. I see you enclosed a build.bat file, but it does not enable bounds checking. If I build and run your project, I get the error, either running or stepping.

forrtl: severe (408): fort: (2): Subscript #1 of the array D_DIST has value 21 which is greater than the upper bound of 2

Image PC Routine Line Source
CopyFolder.exe 004A0EBA Unknown Unknown Unknown
CopyFolder.exe 0049E198 Unknown Unknown Unknown
CopyFolder.exe 00404940 Unknown Unknown Unknown
CopyFolder.exe 00404F61 Unknown Unknown Unknown
CopyFolder.exe 00401122 _MAIN__ 41 CopyFolder.f90
CopyFolder.exe 004A7873 Unknown Unknown Unknown
CopyFolder.exe 0044CA67 Unknown Unknown Unknown
CopyFolder.exe 0044C93F Unknown Unknown Unknown
kernel32.dll 7C817077 Unknown Unknown Unknown
0 Kudos
Reply