- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
링크가 복사됨
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Thanks JugoslavDujic,
your reply is absolutely correct, but I might have not made my issuefully understood. What my real question is:
The data has already been defined as:
real aNum(10)
and
allocation(aNum(10)).
In a big project. Practically, the aNum(0) does not make any sense to my application. but if I can access to aNum(0), it will not do any harm to the software either. In the CVF, due to the run time checking of the array bound has not been implemented very strictly (or it is a bug for CVF). When the program meet the problem to access aNum(0), the CVF does not report a problemunder certain conditionseven though I set the run time checking about the array bound enabled. Now I am porting the project to IVF, such access to aNum(0) is strictly prohibited.I want to work around to set the default low bound of the array to be 0, so that the application will not crash under IVF. I understand this likely does not conforms with the Fortran language standard, but if there is such an option, it will save me a lot of troubles. I am still wondering if the IVF have such an option at all.
Regards,
David
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Ah, sorry, didn't read the first post carefully.
I believe the failure to detect all instances of out-of-bounds access is a bug in CVF.
There's no compiler switch, however, to really compile everything with lower bound of zero. However, you can switch array bounds checking off -- I don't have IVF at hand, but in CVF it was under Project/Settings/Fortran/Run-time, and it's probably in a similarly named category of compiler settings in IVF. Array bounds checking is supposed to be turned off in Release configuration.
However, I can imagine it's possible that you get an Access Violation (instead of Array Bounds Exceeded) error occasionally. (When the accessed memory location happens to be out of heap memory page) -- if that happens, there's no workaround except to rewrite the code.
Jugoslav
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Is this true?
Ciao,
Gerry T.
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Assumed-size arrays? They're the only ones that come to my mind.
program arraybounds
real:: dummy = 1., x(10), dummy2 = 12.
call sub(x)
end program arraybounds
subroutine sub(x)
real:: x(*)
!y = x(0)
!write(*,*) y
y = x(11)
write(*,*) y
end subroutine sub
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
I should hope so.
Ciao,
Gerry T.
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Jugoslav,
I assume that I am the poster of "other thread" you are referring to in your message. The reason I believe the CVF is doing something suspicious is that:
The fortran does not do the short circuit sub expression logical expression according the language itself, which you have explained that at least in the debug mode it won't do that. My guess is even under the release mode, during the compilation, it's not possible to do that. Because thecompiler acutally does not know the result of the otherexpression as it is a variable in my sample.
My guess is the CVF is trying to do the subexpression evaluation and short curcuitting of logical expression. However, it does not do according to the order of expression, suchas from left to right, or from right to left. Because if I change the order of the expression, it shows the same result. The possible way it is doing is:when some value such as the data aNum(0) can not be evaluated, it will defer its evaluation to check other expressions, if other expression can determine the final result of the whole expression, the CVF won't report any problem.
Currently, IVF is doing things different. It will report all such array bound problems which I am more happy with in my personal point of view, the problme with the IVF is its dramatical increase of build size.
Regrds,
David.
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
