Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Beginner
2 Views

Unreferenced statement warning

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
Highlighted
Black Belt
2 Views

The Intel compiler does not

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

Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos
Highlighted
Beginner
2 Views

Thanks. :-(

Thanks. :-(

0 Kudos
Highlighted
2 Views

It would be handy if dead

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

Jim Dempsey

0 Kudos
Highlighted
2 Views

And if there were an option

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
Highlighted
Black Belt
2 Views

The optimization reports do

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.

Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos
Highlighted
New Contributor I
2 Views

The Intel compiler should

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