As suggested on SPEC's documentation page (Known Portability Issues) [1][2] the spec_qsort.c routine does not strictly obey the ANSI aliasing rules. In the absence of -fno-strict-aliasing the test suite fails when Function Specialization is enabled with both LTO and PGO (see https://reviews.llvm.org/D140210).
[1] https://www.spec.org/cpu2017/Docs/benchmarks/502.gcc_r.html
[2] https://www.spec.org/cpu2017/Docs/benchmarks/505.mcf_r.html