Skip to content

dav1d and libdav1d segfault when compiled with GCC 12.1.0 and -flto=auto is set

With -flto=auto

The Meson build system
Version: 0.62.2
Source dir: /home/ferdi/ffmpeg_sources/dav1d
Build dir: /home/ferdi/ffmpeg_sources/dav1d/build
Build type: native build
Project name: dav1d
Project version: 1.0.0
C compiler for the host machine: ccache cc (gcc 12.1.0 "cc (Ubuntu 12.1.0-2ubuntu1~22.04) 12.1.0")
C linker for the host machine: cc ld.bfd 2.38
Host machine cpu family: x86_64
Host machine cpu: x86_64
Fetching value of define "__ILP32__" :  
Run-time dependency threads found: YES
Checking for function "clock_gettime" : YES 
Library dl found: YES
Checking for function "dlsym" with dependency -ldl: YES 
Library m found: YES
Check usable header "stdatomic.h" : YES 
Check usable header "unistd.h" : YES 
Check usable header "io.h" : NO 
Check usable header "pthread_np.h" : NO 
Checking for function "getopt_long" : YES 
Checking for function "_aligned_malloc" : NO 
Checking for function "posix_memalign" : YES 
Checking for function "pthread_getaffinity_np" with dependency threads: YES 
Compiler for C supports arguments -fvisibility=hidden: YES 
Compiler for C supports arguments -Wundef: YES 
Compiler for C supports arguments -Werror=vla: YES 
Compiler for C supports arguments -Wno-maybe-uninitialized: YES 
Compiler for C supports arguments -Wno-missing-field-initializers: YES 
Compiler for C supports arguments -Wno-unused-parameter: YES 
Compiler for C supports arguments -Wstrict-prototypes: YES 
Compiler for C supports arguments -Werror=missing-prototypes: YES 
Compiler for C supports arguments -Wshorten-64-to-32: NO 
Compiler for C supports arguments -fomit-frame-pointer: YES 
Compiler for C supports arguments -ffast-math: YES 
Compiler for C supports arguments -mpreferred-stack-boundary=6: YES 
Fetching value of define "__AVX__" : 1 
Program nasm found: YES (/home/ferdi/bin/nasm)
Configuring config.asm using configuration
Configuring config.h using configuration
Configuring version.h using configuration
Header <xxhash.h> has symbol "XXH3_createState" : YES 
Configuring cli_config.h using configuration
Build targets in project: 10

dav1d 1.0.0

  User defined options
    default_library: static
    libdir         : /home/ferdi/ffmpeg_build/lib
    prefix         : /home/ferdi/ffmpeg_build
    enable_tests   : false
    enable_tools   : true

Found ninja-1.11.0 at /usr/bin/ninja
ferdi@Biodanza01:~/ffmpeg_sources/dav1d/build$ env | grep FLAGS
CXXFLAGS=-march=native -O3 -pipe -flto=auto
LDFLAGS=-fuse-ld=mold
CFLAGS=-march=native -O3 -pipe -flto=auto
ferdi@Biodanza01:~/ffmpeg_sources/dav1d/build$ ninja
[111/111] Linking target tools/dav1d
ferdi@Biodanza01:~/ffmpeg_sources/dav1d/build$ cd tools
ferdi@Biodanza01:~/ffmpeg_sources/dav1d/build/tools$ ./dav1d -i ~/Downloads/video/testvideo/test1.ivf --l 100 -o test.yuv
dav1d 1.0.0-46-gcd5e415 - by VideoLAN
Segmentation fault

Without -flto=auto

ferdi@Biodanza01:~/ffmpeg_sources/dav1d/build/tools$ env | grep FLAGS
CXXFLAGS=-march=native -O3 -pipe
LDFLAGS=-fuse-ld=mold
CFLAGS=-march=native -O3 -pipe
ferdi@Biodanza01:~/ffmpeg_sources/dav1d/build$ meson setup -Denable_tools=true -Denable_tests=false --default-library=static .. --prefix "$HOME/ffmpeg_build" --libdir="$HOME/ffmpeg_build/lib"
The Meson build system
Version: 0.62.2
Source dir: /home/ferdi/ffmpeg_sources/dav1d
Build dir: /home/ferdi/ffmpeg_sources/dav1d/build
Build type: native build
Project name: dav1d
Project version: 1.0.0
C compiler for the host machine: ccache cc (gcc 12.1.0 "cc (Ubuntu 12.1.0-2ubuntu1~22.04) 12.1.0")
C linker for the host machine: cc ld.bfd 2.38
Host machine cpu family: x86_64
Host machine cpu: x86_64
Fetching value of define "__ILP32__" :  
Run-time dependency threads found: YES
Checking for function "clock_gettime" : YES 
Library dl found: YES
Checking for function "dlsym" with dependency -ldl: YES 
Library m found: YES
Check usable header "stdatomic.h" : YES 
Check usable header "unistd.h" : YES 
Check usable header "io.h" : NO 
Check usable header "pthread_np.h" : NO 
Checking for function "getopt_long" : YES 
Checking for function "_aligned_malloc" : NO 
Checking for function "posix_memalign" : YES 
Checking for function "pthread_getaffinity_np" with dependency threads: YES 
Compiler for C supports arguments -fvisibility=hidden: YES 
Compiler for C supports arguments -Wundef: YES 
Compiler for C supports arguments -Werror=vla: YES 
Compiler for C supports arguments -Wno-maybe-uninitialized: YES 
Compiler for C supports arguments -Wno-missing-field-initializers: YES 
Compiler for C supports arguments -Wno-unused-parameter: YES 
Compiler for C supports arguments -Wstrict-prototypes: YES 
Compiler for C supports arguments -Werror=missing-prototypes: YES 
Compiler for C supports arguments -Wshorten-64-to-32: NO 
Compiler for C supports arguments -fomit-frame-pointer: YES 
Compiler for C supports arguments -ffast-math: YES 
Compiler for C supports arguments -mpreferred-stack-boundary=6: YES 
Fetching value of define "__AVX__" : 1 
Program nasm found: YES (/home/ferdi/bin/nasm)
Configuring config.asm using configuration
Configuring config.h using configuration
Configuring version.h using configuration
Header <xxhash.h> has symbol "XXH3_createState" : YES 
Configuring cli_config.h using configuration
Build targets in project: 10

dav1d 1.0.0

  User defined options
    default_library: static
    libdir         : /home/ferdi/ffmpeg_build/lib
    prefix         : /home/ferdi/ffmpeg_build
    enable_tests   : false
    enable_tools   : true

Found ninja-1.11.0 at /usr/bin/ninja
ferdi@Biodanza01:~/ffmpeg_sources/dav1d/build$ ninja
[111/111] Linking target tools/dav1d
ferdi@Biodanza01:~/ffmpeg_sources/dav1d/build$ cd tools
ferdi@Biodanza01:~/ffmpeg_sources/dav1d/build/tools$ ./dav1d -i ~/Downloads/video/testvideo/test1.ivf --l 100 -o test.yuv
dav1d 1.0.0-46-gcd5e415 - by VideoLAN
Decoded 100/100 frames (100.0%) - 397.35/30.00 fps (13.25x)
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information