-
Notifications
You must be signed in to change notification settings - Fork 341
Description
This problem was discovered in CI testing of Meson build system, which contains a wrap (a package) for flac, and which includes a test on arm64 MSVC.
In relation to this problem, Meson build script behaves in same way as CMakeLists.txt: If header file arm_neon.h is present, it defines FLAC__HAS_NEONINTRIN macro. So, unless I missed something, this problem should be replicable with CMake on arm64 MSVC.
https://github.com/xiph/flac/blob/9547dbc2ddfca06a70ea937dbb605bbe78ea5f90/CMakeLists.txt#L112C1-L112C54
https://github.com/mesonbuild/wrapdb/blob/528def7a7ad993771f7b46934c71e191050424a5/subprojects/packagefiles/flac/meson.build#L72
The macro FLAC__HAS_NEONINTRIN enables compilation of code in src/libFLAC/lpc_intrin_neon.c. When this code is build with arm64 MSVC, it fails on initializing Neon vector types using initializer list with 4 values. See CI log:
https://github.com/mesonbuild/wrapdb/actions/runs/20676790132/job/59365484902?pr=2582#step:8:2870
The code causing this looks like this:
flac/src/libFLAC/lpc_intrin_neon.c
Lines 153 to 155 in 9547dbc
| int32x4_t qlp_coeff_0 = {qlp_coeff[0], qlp_coeff[1], qlp_coeff[2], qlp_coeff[3]}; | |
| int32x4_t qlp_coeff_1 = {qlp_coeff[4], qlp_coeff[5], qlp_coeff[6], qlp_coeff[7]}; | |
| int32x4_t qlp_coeff_2 = {qlp_coeff[8], qlp_coeff[9], qlp_coeff[10], 0}; |
This incompatibility was reported to MSVC plenty of times. They argue such initialization is incorrect per ARM specification, and that intrinsics must be used for initialization:
https://developercommunity.visualstudio.com/t/static-initialization-arm64-neon-datatypes/1238406#T-N1257504