The mistake was declaring infinite loops to be UB in the first place.