Campbell Soup Co. on Wednesday served up unappetizing results, but investors showed no sign of recoiling from food stocks generally.

For its fiscal third quarter ended May 2, Campbell posted weak results on the top and especially the bottom line. Organic sales, which strip out currency fluctuations and acquisitions, fell 12% year over year as the business lapped the extraordinary pantry-loading period of a year earlier. More worrying for investors, adjusted earnings before interest and taxes fell 27% from the year-ago period as inflation accelerated in everything from food ingredients to labor, freight and steel for soup cans.

For the full fiscal year ending in August, the company said it now expects adjusted Ebit to fall by 4% to 5%, compared with earlier guidance that it would be basically flat, a sharp downward adjustment given there is just one quarter left in the fiscal year. Chief Executive Mark Clouse said price increases that the company has been negotiating with retailers will provide support to margins but won’t take full effect until the start of next fiscal year.

Campbell shares fell 5% Wednesday morning. Rivals including General Mills and Kraft Heinz were down only slightly, suggesting investors don’t necessarily see the company’s problems extending to the whole sector.

That makes sense, as Campbell faces some challenges that are unique to itself. In addition to general inflation, Mr. Clouse cited “executional pressures” for the margin miss in its snacks business, which includes brands such as Goldfish crackers and where the company is still digesting its 2018 acquisition of Snyder’s-Lance.

On the sales side, consumer survey data continue to suggest that at-home food consumption is likely to remain somewhat elevated post-pandemic. Campbell’s namesake line of soups, however, may well turn out to be particularly associated in consumers’ minds with unglamorous, lockdown-era dining.

Finally, as Barclays analyst Andrew Lazar has noted, the past inflation episodes strongly suggest that packaged-food companies eventually come out of them strengthened, albeit after a lag, once they have been able to push through price increases.

Campbell may be in for a rough summer. But investors shouldn’t give up on the whole sector.

Write to Aaron Back at aaron.back@wsj.com