![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Обнаружил код, на котором крэшится компилятор clang.
Устойчиво валится с вот такой диагностикой:struct {
unsigned : 2;
unsigned a : 6;
unsigned : 1;
unsigned b : 6;
unsigned : 2;
unsigned c : 6;
unsigned d : 1;
unsigned e : 2;
} data = {
.e = 1,
.c = 1,
.a = 1,
};
Версия clang-9 работает. Версии clang-12, clang-14 и clang-16 падают. Отправил bug report в Эппл, посмотрим, как среагируют.$ clang -c code.cpp
clang: error: unable to execute command: Segmentation fault: 11
clang: error: clang frontend command failed due to signal (use -v to see invocation)
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin22.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
clang: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang: note: diagnostic msg: /var/folders/8l/gxp7qhcn32xgfkdm22_gjnkh0000gn/T/code-224576.cpp
clang: note: diagnostic msg: /var/folders/8l/gxp7qhcn32xgfkdm22_gjnkh0000gn/T/code-224576.sh
clang: note: diagnostic msg: Crash backtrace is located in
clang: note: diagnostic msg: /Users/vak/Library/Logs/DiagnosticReports/clang_<yyyy-mm-dd-hhmmss>_<hostname>.crash
clang: note: diagnostic msg: (choose the .crash file that corresponds to your crash)
clang: note: diagnostic msg:
********************
no subject
Date: 2023-05-18 00:32 (UTC)no subject
Date: 2023-05-18 00:56 (UTC)no subject
Date: 2023-05-18 01:23 (UTC)no subject
Date: 2023-05-18 02:26 (UTC)no subject
Date: 2023-05-18 04:13 (UTC)Короче говоря, "вы его неправильно держите".
no subject
Date: 2023-05-18 05:50 (UTC)GCC вообще считает ошибкой инициализацию в неправильной последовательности, и отказывается компилировать. Хотя бы не крэшится.
no subject
Date: 2023-05-18 02:08 (UTC)no subject
Date: 2023-05-18 02:27 (UTC)no subject
Date: 2023-05-18 03:16 (UTC)clang -c code.c
работает
no subject
Date: 2023-05-18 03:40 (UTC)no subject
Date: 2023-05-18 03:50 (UTC)https://en.cppreference.com/w/cpp/language/aggregate_initialization
no subject
Date: 2023-05-18 03:56 (UTC)no subject
Date: 2023-05-18 10:20 (UTC)no subject
Date: 2023-05-18 05:57 (UTC)Да уж. 21-й век.
no subject
Date: 2023-05-18 07:51 (UTC)