vak: (Default)
Serge Vakulenko ([personal profile] vak) wrote2023-05-17 05:14 pm

Нечаянно сломал Си-компилятор

Обнаружил код, на котором крэшится компилятор 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 -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:

********************
Версия clang-9 работает. Версии clang-12, clang-14 и clang-16 падают. Отправил bug report в Эппл, посмотрим, как среагируют.

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org