GATE Computer ScienceVery hardGATE CS (PYQ pattern)

Backpatching with no fall-through optimisation, numbering from 100, translates while (a < b && c < d || e < f) { if (x < y) p = 1; else q = 2; } into three-address code. The loop's body starts right after the test code. What target does the instruction 'goto _' generated for the FALSE exit of the test c < d (the 4th instruction, number 103) receive?

  1. A. 100
  2. B. 104
  3. C. 105
  4. D. 106

Correct answer: B. 104

The false list of 'a<b && c<d' is merged into the false list of the whole && , which the 'or' backpatches to the start of 'e<f' (instruction 104).

More Compiler Design questions

Exams that ask this topic