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

DPD200256205 Have -warn unused warn about unused ONLY names

andrew_4619
Honored Contributor III
5,011 Views

I recall discussing this in a thread somewhere but I can't seem to find it, Anyway this document

https://software.intel.com/en-us/node/520142

Suggests "DPD200256205 Have -warn unused warn about unused ONLY names"  is in the new release. I took this to mean that:

 

USE FRED, ONLY: bill, alan, peter

would throw a warning if for example alan was not used in the scope of the USE. I was quite looking forward to this feature, did it fall off the list at some point or have I misunderstood?

 

 

 

0 Kudos
36 Replies
FortranFan
Honored Contributor III
3,122 Views

I'm looking forward to this feature too and my expectation is also along the lines mentioned by app4619 in the original post.

But I didn't notice such a feature in the 2015 Beta version, so it'll be surprising if it is available in the final release.

0 Kudos
Lorri_M_Intel
Employee
3,122 Views

This was added late in the Beta cycle, and should be in the final product

Are you guys seeing something different?

           --Lorri

0 Kudos
andrew_4619
Honored Contributor III
3,122 Views

Lorri Menard (Intel) wrote:

This was added late in the Beta cycle, and should be in the final product

Are you guys seeing something different?

           --Lorri

I do not seem to be seeing that feature. I was expecting to have quite a number of warnings and when I didn't I deliberately created some lines that should have given a warning. Try a simple test case. 

0 Kudos
Lorri_M_Intel
Employee
3,122 Views

Hmm.   Our regression test looks like this:

module cq256205mymod

integer a, b, c, x

end module cq256205mymod

program cq256205
use cq256205mymod, only: a,b,c
integer d

a = 1
b = 2
print *, "success"
end program

and does issue two warnings when compiled as:

ifort /warn:unused cq256205.f90

One message for "d"  one message for "c"

What is different about your example?

0 Kudos
andrew_4619
Honored Contributor III
3,122 Views

Yes that example works for me also. The example I tried where in a large application with many modules etc. There are also different build options e.g. I only check the warning on debug builds. I will investigate further and report back.

0 Kudos
andrew_4619
Honored Contributor III
3,122 Views

It does not warn when the "unused only" is within a module procedure it would seem. No warning for "c". As all my routines are usually within modules that appears to be why I get no warnings.

module cq256205mymod
    implicit none
    integer a, b, c, x
end module cq256205mymod
    
module fred
    contains
    subroutine bill
        use cq256205mymod, only: a,b,c
        implicit none
        integer f
        a = 1
        b = 2
        print *, "success"    
    end subroutine bill   
end module fred

program cq256205
    use cq256205mymod, only: a,b  
    use fred
    implicit none
    integer d

    a = 1
    b = 2
    print *, "success"
    call bill()
end program 

1>------ Build started: Project: Console3, Configuration: Debug Win32 ------
1>Compiling with Intel(R) Visual Fortran Compiler XE 15.0.0.108 [IA-32]...
1>Console3.f90
1>C:\Users\Andrew\Documents\Cadfil\cadfil_devt_intel\Console3\Console3.f90(11): remark #7712: This variable has not been used.  
1>C:\Users\Andrew\Documents\Cadfil\cadfil_devt_intel\Console3\Console3.f90(22): remark #7712: This variable has not been used.  

0 Kudos
Lorri_M_Intel
Employee
3,122 Views

Thank you for the investigation --- I'll send that info over the wall to my colleague.

 

0 Kudos
FortranFan
Honored Contributor III
3,122 Views

app4619 wrote:

.. As all my routines are usually within modules that appears to be why I get no warnings...

Same situation with me; almost all the code is in modules.

 

0 Kudos
andrew_4619
Honored Contributor III
3,122 Views

Lorri Menard (Intel) wrote:

Thank you for the investigation --- I'll send that info over the wall to my colleague.

 

Was there any feedback on this issue ?

Regards

Andrew

 

0 Kudos
Lorri_M_Intel
Employee
3,122 Views

Hi Andrew --

      He acknowledged that it failed, but there's no schedule for the fix yet.

 

0 Kudos
Steven_L_Intel1
Employee
3,122 Views

I was just informed that the fix for this problem is expected to be in Update 1.

0 Kudos
andrew_4619
Honored Contributor III
3,122 Views

Steve Lionel (Intel) wrote:

I was just informed that the fix for this problem is expected to be in Update 1.

Thanks that will be most welcome :-)

 

0 Kudos
andrew_4619
Honored Contributor III
3,122 Views

And indeed is seems to be working in update 1!

I was pleasantly surprised and the relatively small number of warnings I got when doing a full rebuild of a large project :-)

it is nice to have some spring cleaning in your code even if it is winter.

 

 

0 Kudos
DavidWhite
Valued Contributor II
3,122 Views

Depends where you are ... it's still Spring here until Monday :-)

0 Kudos
Steven_L_Intel1
Employee
3,122 Views

It's technically not winter here for another few weeks, but we did just have our first snow of the season in southern New Hampshire.

0 Kudos
JVanB
Valued Contributor II
3,122 Views

Sounds like the difference between meteorological and astronomical winter. A-basin opened last month, does that make it winter here?

0 Kudos
andrew_4619
Honored Contributor III
3,122 Views
module cq256205mymod
    implicit none
    integer :: a, b, c, x
end module cq256205mymod
    
module fred
    integer :: y,w
    contains
    subroutine bill
        use cq256205mymod, only: a,b,c !c unused remark #7712
        implicit none
        integer f                      !f unused remark #7712
        a = 1
        b = 2
        print *, "success"    
    end subroutine bill   
end module fred

program cq256205                       ! test for /warn:unused Fortran Compiler XE 15.0.1.148 [IA-32]
    use cq256205mymod, only: a,b  
    use fred, only: y,bill             ! bill is NOT reported as unused
    implicit none
    integer d                          ! d unused remark #7712

    a = 1
    b = 2
    y = 1
    print *, "success"
    !call bill()                       
end program

I think I spoke too soon..... I noticed some issues with this feature yesterday and have updated the test that was at #7. The problem is the line 

use fred, only: y,bill as it seems that unused applies to variablies and not module procedures.  Perhaps that was the intention?
0 Kudos
FortranFan
Honored Contributor III
3,122 Views

Yes, it'll be nice if /warn:unused applies to module procedures too.

0 Kudos
Steven_L_Intel1
Employee
3,122 Views

Well, the option's documentation does say: "Determines whether warnings occur for declared variables that are never used." A procedure is not a variable. Nor is a type or an interface. I will enter a feature request that any identifier in a USE list qualify for the warning. Issue ID is DPD200365039.

 

0 Kudos
FortranFan
Honored Contributor III
3,044 Views

See recent discussion at comp.lang.fortran: https://groups.google.com/forum/#!topic/comp.lang.fortran/RedeUCqh12c

I think the warning in this case is unwaranted: thoughts?

0 Kudos
Reply