- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
Using 8.1.023:
Could someone provide an example where -zero makes a difference in their output? I've been trying to do a sanity check, but I must be off someplace.
Using the following code:
Code:
PROGRAM ZERO_SAVE WRITE(*,*) IA END
If I compile WITHOUT -save, I get the output:
0
I guess intrinsic variables that aren't save get initialized to zero?
If I compile with -save, I get the output:
0
This time, the variable IA is statically allocated (verified with nm).
So, is there a short example where you do need to use -zero? I can't seem to get the code to output bad results. When I compile with g77 I get nonsense output which is what I was expecting to get from ifort, since I never compiled with -zero.
Thanks!
링크가 복사됨
2 응답
- 신규로 표시
- 북마크
- 구독
- 소거
- RSS 피드 구독
- 강조
- 인쇄
- 부적절한 컨텐트 신고
It is more likely to affect subroutines, and can depend on optimization choices. My advice is to always explicitly initialize your variables and don't depend on values starting as zero.
