Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!

Unreferenced statement warning

Lester_N_
Beginner
143 Views

Is there some way of triggering the Intel compiler to produce a warning that certain statement lines cannot be executed.  Something like this:

<do something>
9000   GOTO 1000
9020   PRINT *,'This statement will never be executed'

 

The Lahey compiler produces a message like this:

Line 990, file test.for
9020   PRINT *,'This statement will never be executed'
      |
WARNING -- Statement label (9020) not referenced, statements not executed.

0 Kudos
6 Replies
Steve_Lionel
Black Belt Retired Employee
143 Views

The Intel compiler does not have this - at least not in an easy-to-get-at form. (The Digital/Compaq compiler did.)

Lester_N_
Beginner
143 Views

Thanks. :-(

jimdempseyatthecove
Black Belt
143 Views

It would be handy if dead code elimination was included in the reports.

Jim Dempsey

jimdempseyatthecove
Black Belt
143 Views

And if there were an option to not remove dead code.... should one want to keep the code around for debugging (e.g. via Set Next Statement).

Jim Dempsey

Steve_Lionel
Black Belt Retired Employee
143 Views

The optimization reports do have dead code elimination messages, but it's not a simple compiler diagnostic. The compiler doesn't remove dead code if you're not optimizing.

LRaim
New Contributor I
143 Views

The Intel compiler should notify these cases as other compilers do and it is difficult to understand why it does not provide warnings.
Along these lines, some time ago, I pointed out that IVF compiler does not provide any warning about subroutine variables used without any previously assigned value, while the Lahey compiler does. This can save quite a lot time to developers. 

Reply