gold gains for second day as dollar weakens