Global Sources
EE Times-Asia
Stay in touch with EE Times Asia
?
EE Times-Asia > EDA/IP
?
?
EDA/IP??

System limits excessive aggressiveness of compilers

Posted: 23 Oct 2013 ?? ?Print Version ?Bookmark and Share

Keywords:compiler? programming? Java? MIT?

A team of researchers from the Massachusetts Institute of Technology (MIT) has recently developed a system that warns programmers when compilerswhich convert high-level programs into machine-readable instructionsmight simply discard their code. Compilers are computer programs that translate high-level instructions written in human-readable languages such as Java or C into low-level instructions that machines can execute. Most compilers also streamline the code they produce, modifying algorithms specified by programmers so that they'll run more efficiently, indicated the researchers.

However, compilers can sometimes discard lines of code that appear to serve no purpose. Compilers can be overaggressive, dispensing not only with functional code but also with code that actually performs vital security checks.

The team from MIT created a system, dubbed Stack, that automatically combs through programmers' code, identifying just those lines that compilers might discard but which could, in fact, be functional. Although the paper hasn't appeared yet, commercial software engineers have already downloaded Stack and begun using it, with encouraging results.

As strange as it may seem to nonprogrammersor people whose only experience with coding is on small, tightly managed projectslarge commercial programs are frequently full of instructions that will never be executed, known as "dead code." When hundreds of developers are working on an application with millions of lines of code that have been continually revised for decades, one of them may well end up inserting a seemingly innocuous condition that ensures that a function thousands of lines away, written by someone else, never gets executed. Dead code is ubiquitous, and compilers should remove it.

Problems arise when compilers also remove code that leads to "undefined behaviour." "For some things this is obvious," stated Frans Kaashoek, the Charles A. Piper professor in the department of electrical engineering and computer science (EECS). "If you're a programmer, you should not write a statement where you take some number and divide it by zero. You never expect that to work. So the compiler will just remove that. It's pointless to execute it anyway, because there's not going to be any sensible result."

Over time, however, "compiler writers got a little more aggressive," Kaashoek indicated. "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 behaviour that most programmers don't realise are undefined behaviour."

A classic example, said Xi Wang, a graduate student in EECS and first author on the new paper, is the assumption that if a program attempts to store too large a number at a memory location reserved for an integer, the computer will lop off the bits that don't fit. "In machines, integers have a limit," Wang said. "Whenever you exceed that limit, the input value basically wraps around to a smaller value."


1???2?Next Page?Last Page



Article Comments - System limits excessive aggressivene...
Comments:??
*? You can enter [0] more charecters.
*Verify code:
?
?
Webinars

Seminars

Visit Asia Webinars to learn about the latest in technology and get practical design tips.

?
?
Back to Top