- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In some cases the optimization report will mention code it found to be unreachable.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
And in some cases dead code isn't mentioned in opt-report, where it would be mentioned otherwise.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page