- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
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
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I can't think of a good reason. I'll submit this as a bug report.

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page