Massachusetts Institute of Technology (MIT) researchers have developed Stack, a system that automatically combs through programmers' code, identifying those lines that compilers might discard, but that could be functional.
When hundreds of developers work on an application with millions of lines of code that have been continually revised over long periods of time, some of those functions never end up getting executed. These functionless codes, known as dead codes, should be removed. However, problems come up when compilers also remove code that leads to undefined behavior.
"It turns out that the C programming language has a lot of subtle corners to the language specification, and there are things that are undefined behavior that most programmers don't realize are undefined behavior," says MIT professor Frans Kaashoek.
The researchers combed through the C language specifications and tried to identify every possible undefined behavior that a programmer might inadvertently invoke. Stack compiles a program once as it seeks to remove dead code, and then a second time to remove dead code and undefined behavior. Stack then identifies all of the code that was cut the second time but not the first, and warns the programmer it could pose problems.
From MIT News
View Full Article
Abstracts Copyright © 2013 Information Inc., Bethesda, Maryland, USA