Linker Error when building test-suite with PGO

Dear All,

When I build test-suite with following option,

-DTEST_SUITE_PROFILE_GENERATE=ON

I got some errors.
[ 83%] Building C object SingleSource/Regression/C/gcc-c-torture/execute/ieee/CMakeFiles/GCC-C-execute-ieee-fp-cmp-8e.dir/fp-cmp-8e.c.o
[ 83%] Building C object SingleSource/Regression/C/gcc-c-torture/execute/ieee/CMakeFiles/GCC-C-execute-ieee-fp-cmp-3.dir/fp-cmp-3.c.o
CMakeFiles/GCC-C-execute-ieee-compare-fp-3.dir/compare-fp-3.c.o: In function test2': compare-fp-3.c:(.text+0x4d): undefined reference to link_error0’
CMakeFiles/GCC-C-execute-ieee-compare-fp-3.dir/compare-fp-3.c.o: In function test3': compare-fp-3.c:(.text+0x8d): undefined reference to link_error0’
CMakeFiles/GCC-C-execute-ieee-compare-fp-3.dir/compare-fp-3.c.o: In function test5': compare-fp-3.c:(.text+0x113): undefined reference to link_error1’
CMakeFiles/GCC-C-execute-ieee-compare-fp-3.dir/compare-fp-3.c.o: In function test6': compare-fp-3.c:(.text+0x163): undefined reference to link_error1’
CMakeFiles/GCC-C-execute-ieee-compare-fp-3.dir/compare-fp-3.c.o: In function all_tests': compare-fp-3.c:(.text+0x1f0): undefined reference to link_error0’
compare-fp-3.c:(.text+0x223): undefined reference to link_error0' compare-fp-3.c:(.text+0x2f6): undefined reference to link_error1’
compare-fp-3.c:(.text+0x344): undefined reference to `link_error1’
[ 83%] Linking C executable GCC-C-execute-ieee-fp-cmp-1
clang-12: error: linker command failed with exit code 1 (use -v to see invocation)
[ 83%] Building C object SingleSource/Regression/C/gcc-c-torture/execute/ieee/CMakeFiles/GCC-C-execute-ieee-fp-cmp-8l.dir/fp-cmp-8l.c.o

There errors won’t appear if -DTEST_SUITE_PROFILE_GENERATE=OFF.

I got no idea from these error messages. Please allow me to ask for help here.
Has anyone met errors like these before? I appreciate for your help.

Best Wishes,
Liqiang Tao

There might be a bug in the compiler exposed with instrumentation on. The reference to link_error0 is guarded by a conditional branch which evaluates to be false – but the compiler fails to simplify it away leading to linker error.

David