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

Zero initialization of subprogram-local arrays

Stuart_M
Beginner
347 Views
Hello,

From the Intel Fortran for Windows 9 documentation it sounds like -Qzero only guaranteees that scalars are zero initialized but my small test programs make it appear that arrays in main and subprograms are also being zero-initialized. In fact this seems to happen without -Qzero unless I use -automatic. I'd love to know what the guaranteed and actual behavior are wrt zero initialization and if there is any switch for getting local arrays zero initialized.

We are migrating some VAX FORTRAN applications that exploit the default zero initialization that the VAX (but not AXP!) did for scalars and, I believe, arrays along with the implicit SAVE. Until the explicit initializations can be added we need to emulate the VAX behavior as closely as possible. Any suggestions would be great.

Our debug build switches are:

-vms -f77rtl -intconstant -Qansi_alias- -Qcommon_args -Qsave -Qzero -align:dcommons -align:norecords -warn:general -warn:nodeclarations -warn:nounused -warn:nouncalled -check:all -Gs0 -Qfpstkchk -Qtrapuv -debug -traceback -Od

Thanks!
0 Kudos
2 Replies
Steven_L_Intel1
Employee
347 Views
There is no option that guarantees zero-initialization of arrays. My advice is to add such initialization to your code.
0 Kudos
Stuart_M
Beginner
347 Views
Thanks. I wish that were practical but given that there are thousands of them we can't do them all within the available time.

Stuart
0 Kudos
Reply