Inflation will be a key headwind during the second-quarter earnings season as higher prices eat into companies' profit margins, according to Barclays. "In recent quarters, companies were able to maintain margins by drawing down on inventories built up at lower prices and by selling it to cash-rich consumers," analyst Maneesh Deshpande wrote in a Thursday note, referring to wallets boosted by stimulus checks and built-up savings in the early days of the pandemic. Now, however, inflation and commodity prices are high, which is quickly burning through the stores of cash consumers had saved. This is keeping margins under pressure, even as the supply chain improves, Desphande wrote. In June, the consumer price index was 9.1% , the highest number in more than 40 years and more than economists polled by Dow Jones expected. The report also signaled that inflation didn't peak earlier, as some expected. "High levels of inflation can hurt margins as seen during 1970s-1980s even as earnings growth is not affected due to its nominal nature," Deshpande wrote. "So, given the significant increase in recent realized inflation due to supply chain disruptions and higher commodity prices, some softening in margins is expected." This softening is likely to be seen in most sectors, except for those closely linked to commodities such as energy. Still, even given margin pressure due to inflation, Barclays expects S & P 500 earnings this quarter to be a weak surprise. The consensus earnings-per-share forecast for the S & P 500 in the current quarter is $55.40, which is about 1% higher than actual EPS in the previous quarter, the firm found. "Consensus expectations just prior to quarterly earnings season have finally become positive after a gap of 7 quarters with 2Q22 QoQ EPS growth expected to be 1%," said Deshpande. "However, while SPX ex Energy earnings for future quarters have declined they face further downside as the economy slows while the Fed likely tightens the fed fund rate to 3.25-3.5% by year-end." —CNBC's Michael Bloom contributed to this story.