Where are the compiler cross reference listings
In my mainframe background, all compilations were printed. Part of the printout was a cross reference of all the variables: where they were defined and where used.
There have been a load of "shadowed" variables problems lately. If there were a way to create a variables cross reference listing for a program it would be possible to see that the variable defined on line 20 was also defined on line 44. In most cases this is an error. By looking at where each variable was used, you could see that the one defined on line 20 was never given a value.
Re: Where are the compiler cross reference listings
Have you tried any "automated code review" programs, like FindBugs or PMD? They might be able to detect that kind of thing.
List of tools for static code analysis - Wikipedia, the free encyclopedia