Fixed #5107 (redundantAssignment when pointer changes)