This issue is related to the following version circa 20220214 ( 4ee240b ):
clang version 15.0.0 (https://github.com/llvm/llvm-project.git 4ee240b86085ef90d20ce731a434287805d119ea)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
When compiling the following code with O1, clang does not return and continuously consumes up an entire core:
https://partow.net/clang/clang_O1_bug_20220214.zip
I have let clang run for about nine hours before having to break. The expected compile/link time for the example code is about roughly one minute.
user@machine ~/workspace/clang_O1_bug_20220214 $ time make exprtk_real_test
clang++ -pedantic-errors -Wall -Wextra -Werror -std=c++11 -O1 -o exprtk_real_test exprtk_real_test.cpp -L/usr/lib -lstdc++ -lm
^Cmake: [Makefile:34: exprtk_real_test] Interrupt (ignored)
real 547m54.763s
user 0m0.004s
sys 0m0.015s
Note: During the run time I did not observe any changes in the amount of memory being consumed by the clang process.
The code compiles and links error and warning free on ALL other optimisation levels (O0, O2, O3) for the above denoted version of clang.
Furthermore the code compiles and links error and warning free on ALL optimisation levels for the following compilers and versions:
- g++ 4.3 .. 11
- clang++ 10, 13