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

Trying to catch use of uninitialized variables (revisited)

albert
Beginner
496 Views
I'm running some tests on the "Static Verifier" with the Intel Fortran 10.1 compiler (ifort (IFORT) 10.1 20080112).
When using the following program:
PROGRAM tst
implicit none
integer c
write(*,*) 'Anything'
write(*,*) c
end
subroutine tt(c)
integer c
write(*,*) c
end

it reports (as expected):
uninit.f90(6): error #12143: [SV] "C" is uninitialized
uninit.f90(8): warning #12222: [SV] routine "tt" is never
called from the MAIN program unit
command line:
ifort -diag-enable sv3 -free uninit.f90 -o uninit


When altering the program to:
PROGRAM tst
implicit none
integer, allocatable :: a(:)
integer c
write(*,*) 'Anything'
allocate(a(10))
write(*,*) c
write(*,*) a(5)
end
subroutine tt(c)
integer c
write(*,*) c
end

Again the correct result, although not catching, as expected, the uninitialized a(5):
uninit.f90(7): error #12143: [SV] "C" is uninitialized
uninit.f90(10): warning #12222: [SV] routine "tt" is never
called from the MAIN program unit


Changing the command line to:
ifort -diag-enable sv3 -g -traceback -free -check all uninit.f90 -o uninit

I get the messages:
uninit.f90(7): error #12143: [SV] "C" is uninitialized
uninit.f90(8): warning #12137: [SV] definition of
procedure "emit_diagnostic" is not found

This last message I don't understand, I would have expected a message about routine "tt"

Another question is how an I check the routines inside my own library (i.e. objects I compiled with -diag-enable sv3 and placed in a library) ?

Albert

0 Kudos
3 Replies
Steven_L_Intel1
Employee
496 Views
The message about emit_diagnostic is a bug. There is no way to use SV on a library - you would have to add the library sources to a project and build with SV.
0 Kudos
albert
Beginner
496 Views
Thanks for the answer.

- Is there already a bug filed for the
"emit_diagnostic" ?
- pitty a library cannot be used, is this a principle problem ? I will use all objects on the command line.

Albert
0 Kudos
Steven_L_Intel1
Employee
496 Views
I believe that the emit_diagnostic issue has been reported. Theoretically, SV could work with libraries the same way that IPO does, but the current implementation does not support it. We are working on a significantly revised implementation of SV for the future and I will ask that libraries be considered.
0 Kudos
Reply