llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.03k stars 11.58k forks source link

Compiling `ffmpeg` on Linux with `-fveclib=mvec` breaks the maths #107364

Open abique opened 2 weeks ago

abique commented 2 weeks ago

Hi,

I've been building ffmeg using both clang 18 and clang 19 and it resulted in the aac codec and the vorbis codec unable to decode correctly the audio.

The issue was triggered by -fveclib=mvec.

I did install clang using the llvm script in a ubuntu 22.04 docker image. I did build ffmpeg using vcpkg and a custom triplet.

set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_CMAKE_SYSTEM_NAME Linux)

set(VCPKG_C_FLAGS "-D_FILE_OFFSET_BITS=64 -mfpmath=sse -pipe -march=x86-64 -msse4.1 -fPIC -fveclib=libmvec")
set(VCPKG_CXX_FLAGS "-D_FILE_OFFSET_BITS=64 -mfpmath=sse -pipe -march=x86-64 -msse4.1 -fPIC -fveclib=libmvec")
set(VCPKG_LINKER_FLAGS "-lm")

set(VCPKG_C_FLAGS_RELEASE "-DNDEBUG -O3")
set(VCPKG_CXX_FLAGS_RELEASE "-DNDEBUG -O3")

I imagine that building ffmpeg with -O3 -fveclib=mvec will be enough to trigger issues in their test suite.

Cheers, Alex

arsenm commented 2 weeks ago

This ticket as-is isn't really actionable as a compiler bug. It's vague as to what is broken, and isn't reduced to any specific code or behavior. This would be better treated as an ffmpeg bug at this level of description for reduction

abique commented 2 weeks ago

This ticket as-is isn't really actionable as a compiler bug. It's vague as to what is broken, and isn't reduced to any specific code or behavior. This would be better treated as an ffmpeg bug at this level of description for reduction

I'm not sure, but I don't think it is an ffmpeg bug. Maybe we'll be lucky and an ffmpeg developer will investigate it and create a more precise bug report.

In the meantime it is good to have this issue documented here.

arsenm commented 1 week ago

I'm not sure, but I don't think it is an ffmpeg bug. Maybe we'll be lucky and an ffmpeg developer will investigate it and create a more precise bug report.

Did you file it as an ffmpeg bug? ffmpeg developers won't be looking here for this

abique commented 1 week ago

I'm not sure, but I don't think it is an ffmpeg bug. Maybe we'll be lucky and an ffmpeg developer will investigate it and create a more precise bug report.

Did you file it as an ffmpeg bug? ffmpeg developers won't be looking here for this

No because it's likely a compiler bug, not an ffmpeg bug. It is triggered by -fveclib=mvec.

abique commented 1 week ago

I've reported it to ffmpeg as well: https://trac.ffmpeg.org/ticket/11176#ticket