The S&P 500 hit a new record on Wednesday, even as soaring gas prices fuel inflation and consumer confidence sinks.