Goldman Sachs says its second-quarter profit doubled, boosted by a surge in stock and bond underwriting.