No, he's literally guarding the place. The correct response to an attack may involve inserting the clip, chamber a round and issue a loud warning before possibly firing.
An attack on the guard himself is likely to lead to a resolute counterattack.
Soldiers guarding typically have limited police jurisdiction of the area they guard in most countries.
This should be common knowledge.