-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Description
I think I've struck upon this issue again #53826 albeit this time at different optimisation levels and different code and not a complete stall.
When compiling the following code with O2 and O3, clang does not return in a timely manner when compared with GCC:
https://partow.net/clang/strtk_clang_O2O3_issue_20251008.zip
The expected compile/link time for the example code is roughly ~8-10seconds .
time clang-22 -O2 -DNDEBUG -std=c++11 -pedantic-errors -Wall -Wextra -Werror -o strtk_tokenizer_test_clang-22_O2 strtk_tokenizer_test.cpp -lstdc++ -lm
real 3m39.413s
user 3m38.766s
sys 0m0.598s
time clang-22 -O3 -DNDEBUG -std=c++11 -pedantic-errors -Wall -Wextra -Werror -o strtk_tokenizer_test_clang-22_O3 strtk_tokenizer_test.cpp -lstdc++ -lm
real 3m38.920s
user 3m38.439s
sys 0m0.443s
time g++-15 -O2 -DNDEBUG -std=c++11 -pedantic-errors -Wall -Wextra -Werror -o strtk_tokenizer_test_clang-22_O2 strtk_tokenizer_test.cpp -lstdc++ -lm
real 0m8.852s
user 0m8.459s
sys 0m0.282s
time g++-15 -O3 -DNDEBUG -std=c++11 -pedantic-errors -Wall -Wextra -Werror -o strtk_tokenizer_test_clang-22_O3 strtk_tokenizer_test.cpp -lstdc++ -lm
real 0m9.744s
user 0m9.432s
sys 0m0.299s
Roughly 22x time difference.
The code compiles and links error and warning free, completing in a timely manner, with optimisation levels O0 and O1 and Debug (-g) for the above denoted code for the following versions of clang: 15, 17, 18, 19, 20, 21, 22 for C++ standard versions: 11, 14, 17, 20, 23 (for the applicable compilers).
Ubuntu clang version 15.0.7
clang version 17.0.0 (https://github.com/llvm/llvm-project.git cdcefd2f9a2d08e774fc7dcf631361a03bf6b810)
clang version 18.0.0 (https://github.com/llvm/llvm-project.git 985a72b6b3e74f0d29780b2a97b5817473338ffe)
clang version 19.0.0git (https://github.com/llvm/llvm-project.git decbd29f9e9be50756a083cd677f7fea22cd3c91)
clang version 20.0.0git (https://github.com/llvm/llvm-project.git 9685681aa47561c9941bb70aa84a09c55c7db824)
clang version 21.0.0git (https://github.com/llvm/llvm-project.git 8d9911e4a06c1c09857a34c369f2caa87506c64b)
clang version 22.0.0git (https://github.com/llvm/llvm-project.git 0c3cf200f5b918fb5c1114e9f1764c2d54d1779b)
The code compiles and links error and warning free on ALL optimisation levels and debug using GCC for the following versions: 7.2 .. 15
fyi: @fhahn @AaronBallman