Skip to content
Related Articles
GATE | GATE-CS-2017 (Set 1) | Question 14
• Last Updated : 20 Feb, 2017

Consider the following intermediate program in three address code

```p  = a - b
q = p * c
p = u * v
q = p + q
```

Which one of the following corresponds to a static single assignment from the above code

A)

```p1 = a - b
q 1 = p1 * c
p1 = u * v
q1 = p1 + q1
```

B)

```p3 = a - b
q4 = p3 * c
p4 = u * v
q5 = p4 + q4
```

C)

```p 1 = a - b
q1 = p2   * c
p3 = u * v
q2 = p4 + q3
```

D)

```p1 = a - b
q1 = p * c
p2 = u * v
q2 = p + q
```

(A) A
(B) B
(C) C
(D) D

Answer: (B)

Explanation: According to Static Single Assignment

1. A variable cannot be used more than once in the LHS
2. A variable should be initialized atmost once.

Now looking at the given options

• a – code violates condition 1 as p1 is initialized again in this statement: p1 = u * v
• c- code is not valid as  q1 = p2 * c , q2 = p4 + q3 – In these statements p2, p4, q3 are not initialized anywhere
• d- code is invalid as  q2 = p + q is incorrect without moving it to register

Therefore, option B is only correct option.

Quiz of this Question

Attention reader! Don’t stop learning now. Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up