2 2 votes Consider the control flow graph below :\[\begin{array}{|l|l|l|}\hline\text{Basic Block} & \text{Statements} & \text{Control Flow Edges} \\\hline\textbf{B1} & a=b+c ;\ d=a * 2 & \text{B1} \to \text{B2} \\\hline\textbf{B2} & e=d-1 ;\ f=e / 2 & \text{B2} \to \text{B3},\text{B2} \to \text{B4}\ \text{(Conditional Split)} \\\hline\textbf{B3} & d=f+5 & \text{B3} \to \text{B4} \\\hline\textbf{B4} & g=a+d & \text{B4} \to \text{Exit} \\\hline\end{array}\]The variables which are live both at the statement in basic block $\textbf{3}$ (entry) and at the statement in basic block $\textbf{4}$ (entry) of the above control flow graph are: $\mathrm{a, d, f}$ $\mathrm{a, d}$ $\mathrm{a, f}$ $\mathrm{a}$ Compiler Design goclasses compiler goclasses-cs-dpp goclasses-cs-dpp-day-149 goclasses-compiler-practice-questions + – GO Classes 368 views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
1 1 vote Variables Live at entry : B3: f, a B4: a, d Thus 'a' is there in both, Answer(D) Samrat_Ghosh answered Dec 15, 2025 Samrat_Ghosh comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes To determine the variables that are live both at the entry of B3 and at the entry of basic block 4 (B4), we work backward from the program's exit. A variable is live if its current value might be used on some subsequent execution path before being redefined (killed). At Entry of B4: The statement in B4 is g = a + d. This statement uses variables a and d. Since control flows to Exit after this, and these values are used, both a and d are live at the entry of B4.At Entry of B3: The statement in B3 is d = f + 5. This statement uses f on the right side. The variable d is redefined (killed) on the left side. The control flow from B3 goes to B4.Since a is live at B4's entry and not used or redefined in B3, a is also live at B3's entry.Since d is redefined in B3, the value of d from before B3 is not used in B4, so d is not live at B3's entry.f is used in B3, making it live at B3's entry. It is not used in B4.Common Live Variables: The variables live at both locations are the intersection of the live variables at B3 entry (a, f) and B4 entry (a, d). The only variable common to both sets is a. BooleanLattice answered Dec 8, 2025 BooleanLattice comment Share Follow 0 reply Please log in or register to add a comment.
0 0 votes D JAY_THAKAR answered Jan 14 JAY_THAKAR comment Share Follow 0 reply Please log in or register to add a comment.