I wouldn't think anyone can GUARANTEE it, but assuming you enable at least some optimisation, I'd be very disappointed if any modern compiler didn't remove unnecessary pointer indirections... I have certainly seen more intricate problems that the compiler has figured out how to simplify.
I take it you haven't looked at the generated code to determine what it does (because your question would have been phrased differently).