- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
When starting a program, initially all integer and real are zero,but with IVF this is different compared to CVF. To be correct, som are, some are not, but they are all declared in the same manner. In the example below, "icall" has the initial value 33619979 but should be 0. Is there an simple explanation for this?
Another question, the compiler directives used in CVF were not deleted when I converted the project to IVF. Does this means that also the Intel compiler is using them?
Regards
Reidar
! Trap user command from window hwndUser
if(hWnd==hwndUser)thenicall=icall+1
if(icall.eq.1)then do j=1,128filebuff2(J:J)=' '
enddobret=SetCaretPos(0,0)
newl=0 ; oldl=0
endifLink Copied
3 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ifort doesn't necessarily duplicate CVF initialization, except for standard Fortran explicit initialization (using DATA or declaration with initialization expression). SAVE must be explicit to be safe, if required. You don't show your code, so I can state only generalities.
I would expect the DEC$ ATTRIBUTES to be observed; check the help file to make sure your use conforms to documentation.
I would expect the DEC$ ATTRIBUTES to be observed; check the help file to make sure your use conforms to documentation.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Intel Fortran provides default initialization for exactly the same number of variables as CVF - zero. CVF does not have such a feature. What might have you thinking it did was that CVF assumed SAVE semantics for local variables, whereas ifort does not. This means that local scalar variables are much more likely to end up on the stack than statically allocated and thus uninitialized variables will have unpredictable values. You can match the CVF behavior by adding the /Qsave switch or, in Visual Studio, set Fortran > Data > Local Variable Storage > All variables SAVE. In a future update, this will be set by default for projects converted from CVF - we goofed in not doing this from the start.
Actually, Intel Fortran does have a feature to do zero initialization of SOME variables, enabled with the /Qzero option, but this is for static, local variables only (and thus tends to require /Qsave as well.)
As for the !DEC$ directives - all of these from CVF are supported by Intel Fortran. If you look in the manual you'll see them listed in a chapter titled "Directive Enhanced Compilation" (or DEC).
Actually, Intel Fortran does have a feature to do zero initialization of SOME variables, enabled with the /Qzero option, but this is for static, local variables only (and thus tends to require /Qsave as well.)
As for the !DEC$ directives - all of these from CVF are supported by Intel Fortran. If you look in the manual you'll see them listed in a chapter titled "Directive Enhanced Compilation" (or DEC).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Steve and Tim18,
The Qsave switch solved my problem with initialization.
Best regards
Reidar

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