Issue 161977
Summary Clang stalls when compiling with O2 O3 optimisation levels
Labels clang
Assignees
Reporter ArashPartow
    I think I've struck upon this issue again https://github.com/llvm/llvm-project/issues/53826 albeit this time at different optimisation levels and different code.

When compiling the following code with **O2** and **O3**, clang does not return and continuously consumes up an entire core:

[https://partow.net/clang/strtk_clang_O2O3_issue_20251008.zip](https://partow.net/clang/strtk_clang_O2O3_issue_20251008.zip)

I have let clang run for about 30 minutes before having to break. The expected compile/link time for the example code is roughly 2 seconds .

 user@machine ~/workspace/strtk_clang_O2O3_issue_20251008 $ 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
 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
 ^C
    
    real    31m24.331s
    user    0m0.004s
    sys 0m0.015s
    

------------

The code compiles and links error and warning free on optimisation levels **O0** and **O1** and **Debug (-g)** for the above denoted code for the following versions of clang:  14, 15, 17, 18, 19, 20, 21, 22 for C++ standard versions: 11, 14, 17, 20, 23 _(for the applicable compilers)_.

    Ubuntu clang version 14.0.0-1ubuntu1.1
 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 




_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to