- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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!
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
bump
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.

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