- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Does Intel Fortran have a compiler option that forces static numeric variables to be initialised to zero?
I have seen the /Qzero and /Qtrapuv options. However, they don't seem to fit the bill.
Alternatively, is there an option to cause warning to be produced if a variable is used without having been initialised? I can understand that C compilers can do this because goto is rare in C. I'm not sure whether such a warning is possible in Fortran where goto might be present.
Thanks for your attention.
Leigh.
I have seen the /Qzero and /Qtrapuv options. However, they don't seem to fit the bill.
Alternatively, is there an option to cause warning to be produced if a variable is used without having been initialised? I can understand that C compilers can do this because goto is rare in C. I'm not sure whether such a warning is possible in Fortran where goto might be present.
Thanks for your attention.
Leigh.
1 Solution
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Leigh,
I think that you have to also use the /Qsave option (save local variables in static allocation ) with the /Qzero option. However you did not mention which version of the compiler you are using.
Concerning the use of local, uninitialized variables, the compiler shouldnormally give you some warning message.
Phil.
Link Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Leigh,
I think that you have to also use the /Qsave option (save local variables in static allocation ) with the /Qzero option. However you did not mention which version of the compiler you are using.
Concerning the use of local, uninitialized variables, the compiler shouldnormally give you some warning message.
Phil.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
The version is 2011.0.14.
I should also say that the body of code I am working on is legacy code. These variables are also at the program level. Does /Qsave have an effect on those.
Thanks,
Leigh.
The version is 2011.0.14.
I should also say that the body of code I am working on is legacy code. These variables are also at the program level. Does /Qsave have an effect on those.
Thanks,
Leigh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The compiler offers run-time errors for uses of uninitialized local variables through /check:uninit. It has some limitations.
/Qtrapuv, in its current implementation, does nothing useful.
/Qtrapuv, in its current implementation, does nothing useful.

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