Neon code fails to build with ARM64 MSVC
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 2.4k
- Forks
- 363
- PR merge metrics
- No merged PRs in 30d
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:
https://github.com/xiph/flac/blob/9547dbc2ddfca06a70ea937dbb605bbe78ea5f90/src/libFLAC/lpc_intrin_neon.c#L153-L155
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with CMakeLists.txt and src/libFLAC/lpc_intrin_neon.c, especially the Neon vector initialization around the lines linked in the issue. Reproduce the build with CMake on ARM64 MSVC, then verify that the affected FLAC code builds successfully without changing other platforms.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, cmake
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100