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

Unreachable Code

I have inherited a code that has a lot of poor coding techniques.  In the ~50,000 lines of FORTRAN there is a significant amount of code that can never be reached.  In older mainframe compilers (e.g., FTN for CDC machines) the compiler cross-reference map would help to find such coding problems.  Is there  a way to use Intel's compiler to find such problems?

0 Kudos
5 Replies
Highlighted
Black Belt
11 Views

The key is to distinguishing

The key is to distinguish between truly dead code and code that may be dead most of the time but, for certain input data, may be executed. The compiler and the linker are pretty good at removing dead code from the EXE. However, if you want to prune the source code itself, you can run the static analysis tool (not supplied with the Composer editions) on the source code or use Amplifier to profile your source code in one or more runs.

The compiler does generate a cross-reference listing for each program unit, if you ask it to. Similarly, the linker can produce a map. 

There are third party tools that specialize in such tasks, such as SPAG and Forcheck.

0 Kudos
Highlighted
Beginner
11 Views

We have found code that is

We have found code that is truly dead, but not given a proper funeral.  We are sure there is a lot more of the same.

I have looked for the ability to generate a cross-reference map (variables and labels) but have not found it.  Can you direct me to the proper option to invoke?

I will check into the static analysis tool and the third party tools.  Thanks. 

0 Kudos
Highlighted
Black Belt
11 Views

The /list option outputs a

The /list option outputs a listing file (.lst) with a line-numbered listing, followed by a list of labels and references, a list of variables and references, and finally a list of the compiler options in effect. I do not remember the exact version of Ifort in which cross-reference lists were made available, but I remember some threads in which Dr. Fortran announced that it was in the works.

0 Kudos
Highlighted
11 Views

In some cases the

In some cases the optimization report will mention code it found to be unreachable.

Retired 12/31/2016
0 Kudos
Highlighted
Black Belt
11 Views

And in some cases unreachable

And in some cases dead code isn't mentioned in opt-report, where it would be mentioned otherwise.

0 Kudos