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

Cursory behavior of /warn:unused

mecej4
Honored Contributor III
1,013 Views

The /warn:unused option does not catch many instances of unused variables in Ifort 16.0, and many checks are inhibited by the presence of contained routines of no relevance to catching unused variables.

Here is an example.

subroutine xyz(i,j,k)
integer p,q,r
p=2
q=p*2
return

!contains
!subroutine klm
!end subroutine

end

Compiling with /Od /warn:unused gives:

xyz.f90(1): remark #7712: This variable has not been used.   
subroutine xyz(i,j,k)
---------------^
xyz.f90(1): remark #7712: This variable has not been used.   
subroutine xyz(i,j,k)
-----------------^
xyz.f90(1): remark #7712: This variable has not been used.   
subroutine xyz(i,j,k)
-------------------^
xyz.f90(2): remark #7712: This variable has not been used.   
integer p,q,r
------------^

If the three comment marks are removed from lines 7,8 and 9, the output text from the compiler is reduced to:

xyz.f90(2): remark #7712: This variable has not been used.   
integer p,q,r
------------^

even though the contained subroutine has no variables and has an empty body.

0 Kudos
2 Replies
Steven_L_Intel1
Employee
1,013 Views

Thanks - we'll look into this.

0 Kudos
Steven_L_Intel1
Employee
1,013 Views

This has been fixed for the next major release (second half of 2016).

0 Kudos
Reply