5d to 3d compactifications and discrete anomalies