SO2 and OCS toward high-mass protostars: a comparative study of ice and gas