Good question. It really just depends on the amount and difference of expansion, and whether it caused high enough stress to matter. We could calculate it, but in reality I don't think it's a problem.

I have no problem using some sort of locking agent (Loctite, Rockset, etc) under the gas block if there's any doubt. They suck to remove later, but it can be done.
Usually with a set screw gas block (that's mostly what I use) I'll put a big drop of Loctite 243 in each set screw hole after the block is on the barrel. Installing the screws squeezes it out between the block and barrel, and I've never had one loosen. I also don't get my barrels smoking hot though; they'll get too hot to hold but not hot enough to break down the loctite.