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

Static Verification errors

dherndon
Beginner
496 Views
The following program generates three SV errors.

program example

implicit none

type T_DEF
integer(4) i(3)
real(4) r(3)
end type T_DEF
type(T_DEF) tst(10)

integer(4) j
real(8) r8(3)

r8(1) = 1.0d0
r8(2:3) = r8(1)

do j = 1, 10
tst(j)%i(1:3) = 1
tst(j)%r(1:3) = 1.0
enddo

end program example

The errors are

1. example.f90(15): error #12049: [SV] Buffer overflow: array index of "R8" is possibly outside the bounds; array "R8" of size (1:3) can be indexed by value 4
2. example.f90(18): error #12049: [SV] Buffer overflow: array index of "I" is possibly outside the bounds; array "I" of size (0:2) can be indexed by value 10
3. example.f90(19): error #12049: [SV] Buffer overflow: array index of "R" is possibly outside the bounds; array "R" of size (0:2) can be indexed by value 10
I don't understand why the first message is generated. The last two are simple incorrect. It is interesting that the bounds in errors 2 and 3 are given in "C" format (0:2) not the "FORTRAN" format (1:3).

Any reason why these messages are generated?
Dave
0 Kudos
1 Reply
Steven_L_Intel1
Employee
496 Views
I can't think of a good reason. I'll submit this as a bug report.
0 Kudos
Reply