Gold gains as stocks fall; weak US data spurs safe-haven demand