Global markets are set to close out their most bruising first half of a year in decades, leaving investors bracing for the prospect of further losses. Accelerating inflation and rising interest rates have fueled a monthslong rout that left few markets unscathed. The S&P 500 fell 20% through Wednesday, heading for its worst first half of a year since 1970, according to Dow Jones Market Data. Investment-grade bonds, as measured by the iShares Core U.S. Aggregate Bond exchange-traded fund, lost 11%—on course for their worst start to a year ever.