U.S. stocks switched between small gains and losses on Wednesday, as investors weighed mixed earnings from Boeing Co, Delta Air Line, Inc and PepsiCo Inc.

The S&P 500 hovered near the intraday record it set shortly after the opening bell. Price declines in Boeing Co. stock after earnings results weighed on the Dow industrials.

Geopolitical tensions flared up after news that two Ukrainian fighter jets were shot down Wednesday near where Malaysia Airlines Flight MH17 was downed.

The S&P 500 (SPX) was 2 points, or 0.1%, higher at 1,985.52. The Dow Jones Industrial Average (DJI) dipped 27 points, or 0.2%, to 17,084.04. The Nasdaq Composite (RIXF) added 11 points, or 0.2%, to 4,467.89.

Follow MarketWatch's live blog of today's stock-market action.

The data calendar is empty for Wednesday, leaving investors to fix their attention on corporate earnings. Boeing (BA) fell 2.4% even as the plane manufacturer lifted its core earnings-per-share outlook for 2014.

PepsiCo (PEP) rallied 4% after the company's second-quarter profit beat estimates and it lifted earnings guidance.

Delta Air Lines Inc. shares (DAL) climbed 3% after the company's second-quarter profit jumped 17%, driven by higher passenger and operating revenue.

Whirlpool Corp.(WHR) posted weaker-than-expected earnings, and shares slid 4.4%.

Investors also reacted to big tech earnings that came late Tuesday. Apple (AAPL) shares rose 1.6% after earnings that topped expectations. Also read: 5 reasons why Apple shares could rise another 16% this year.

Microsoft shares were flat after an analyst's upgrade. The company late Tuesday reported a 7.1% fall in quarterly profit, disappointing Wall Street forecasters, as it took a financial hit from the purchase of Nokia Corp's (NOK) cellphone unit.

After the close, earnings from Facebook Inc. (FB) and AT&T Inc. (T) will be among the highlights. (Read more about the day's notable movers here: http://www.marketwatch.com/story/apple-intuitive-surgical-among-stocks-to-watch-2014-07-23.)

Among other markets, the Stoxx Europe 600 index edged up 0.2% Wednesday, while Asia also logged a mostly-higher finish.

Crude oil prices (CLU4) rose ahead of key supply data, while gold prices (GCU4) were flat. The dollar rose against the British pound (GBPUSD)(GBPUSD) after minutes from the Bank of England's July meeting showed all members voted to keep monetary policy loose.