Stocks rebounded Wednesday, with the S&P 500 and Nasdaq setting fresh intraday and closing records, while gold futures continued their ascent after surpassing $4,000 per ounce for the first time.