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

Unreferenced statement warning

Lester_N_
Beginner
1,697 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
Honored Contributor III
1,697 Views

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

0 Kudos
Lester_N_
Beginner
1,697 Views

Thanks. :-(

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,697 Views

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

Jim Dempsey

0 Kudos
jimdempseyatthecove
Honored Contributor III
1,697 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

0 Kudos
Steve_Lionel
Honored Contributor III
1,697 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.

0 Kudos
LRaim
New Contributor I
1,697 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. 

0 Kudos
Reply