COMPUTER SCIENCE AND ENGINEERING
COMPILER DESIGN
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
|
Live code
|
|
Dead code
|
|
Constant
|
|
Variable
|
Detailed explanation-1: -A local variable that is assigned a value but is not read by any subsequent instruction is referred to as a dead assignment, and assigned variable is dead variable (opposite to live variable). Dead assignments do not affect program results, thus they can be eliminated.
Detailed explanation-2: -Code that is never executed is known as dead code. Typically, the presence of dead code indicates that a logic error has occurred as a result of changes to a program or the program’s environment. Dead code is usually optimized out of a program during compilation.
Detailed explanation-3: -Dead Variable :A dead variable is simply the one that is written but never read. Those variables just cause memory overhead. A dead variable could be the one which is read only or write only.
Detailed explanation-4: -Dead code is executed without its result being used, while the unreachable code, as the name suggests, is never executed in the first place. (To fix that, you can use a flow analysis tool to map our your control flow and find unreachable branches.)
Detailed explanation-5: -Dead code is code that can never be executed in a running program. The surrounding code makes it impossible for a section of code to ever be executed.