Bug#1121183: /usr/bin/x86_64-linux-gnu-g++-15: src/gallium/drivers/zink/zink_draw.cpp:671:49: internal compiler error: Segmentation fault
Package: g++-15-x86-64-linux-gnu
Version: 15.2.0-7
Severity: important
File: /usr/bin/x86_64-linux-gnu-g++-15
X-Debbugs-Cc: witold.baryluk@gmail.com
Dear Maintainer,
this is regression. gcc from Debian testing just few weeks ago was
working fine when compiling mesa from git.
But today I upgraded packages, and when building mesa I got things like
this:
```
ninja: Entering directory `/home/user/mesa-git/builddir/build-amd64-opt/mesa/'
[45/82] Compiling C++ object src/gallium/drivers/zink/libzink.a.p/zink_draw.cpp.o
FAILED: [code=1] src/gallium/drivers/zink/libzink.a.p/zink_draw.cpp.o
/usr/bin/x86_64-linux-gnu-g++-15 -Isrc/gallium/drivers/zink/libzink.a.p -Isrc/gallium/drivers/zink -I../../../src/gallium/drivers/zink -Iinclude -I../../../include -Isrc -I../../../src -I../../../src/gallium/include -Isrc/gallium/auxiliary -I../../../src/gallium/auxiliary -Isrc/vulkan/util -I../../../src/vulkan/util -Isrc/compiler/nir -I../../../src/compiler/nir -Isrc/compiler -I../../../src/compiler -Isrc/compiler/spirv -Isrc/util -Isrc/util/format -I/usr/include/valgrind -I/usr/include/x86_64-linux-gnu -I/home/user/mesa-git/installdir/build-amd64-opt/install/include -I/home/user/mesa-git/installdir/build-amd64-opt/install/include/libdrm -fvisibility=hidden -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -std=c++17 -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS '-DPACKAGE_VERSION="26.0.0-devel"' '-DPACKAGE_BUGREPORT="https://gitlab.freedesktop.org/mesa/mesa/-/issues"' -DHAVE_OPENGL=1 -DHAVE_OPENGL_ES_1=1 -DHAVE_OPENGL_ES_2=1 -DHAVE_RADEONSI -DHAVE_R600 -DHAVE_ZINK -DHAVE_VIRGL -DHAVE_SOFTPIPE -DHAVE_LLVMPIPE -DHAVE_SWRAST -DMESA_SYSTEM_HAS_KMS_DRM=1 -DVIDEO_CODEC_VC1DEC=1 -DVIDEO_CODEC_H264DEC=1 -DVIDEO_CODEC_H264ENC=1 -DVIDEO_CODEC_H265DEC=1 -DVIDEO_CODEC_H265ENC=1 -DVIDEO_CODEC_AV1DEC=1 -DVIDEO_CODEC_AV1ENC=1 -DVIDEO_CODEC_VP9DEC=1 -DHAVE_X11_PLATFORM -DHAVE_WAYLAND_PLATFORM -DHAVE_SURFACELESS_PLATFORM -DHAVE_DRM_PLATFORM -DHAVE_XCB_PLATFORM -DUSE_LIBGLVND=1 -DHAVE_VA_SURFACE_ATTRIB_DRM_FORMAT_MODIFIERS -DGLX_INDIRECT_RENDERING -DGLX_DIRECT_RENDERING -DGLX_USE_DRM -DGLAPI_EXPORT_PROTO_ENTRY_POINTS=0 -DALLOW_KCMP -DMESA_DEBUG=0 -DENABLE_SHADER_CACHE '-DMESA_SHADER_CACHE_MAX_SIZE="8G"' -DHAVE___BUILTIN_BSWAP32 -DHAVE___BUILTIN_BSWAP64 -DHAVE___BUILTIN_CLZ -DHAVE___BUILTIN_CLZLL -DHAVE___BUILTIN_CTZ -DHAVE___BUILTIN_EXPECT -DHAVE___BUILTIN_FFS -DHAVE___BUILTIN_FFSLL -DHAVE___BUILTIN_POPCOUNT -DHAVE___BUILTIN_POPCOUNTLL -DHAVE___BUILTIN_UNREACHABLE -DHAVE___BUILTIN_TYPES_COMPATIBLE_P -DHAVE___BUILTIN_ADD_OVERFLOW -DHAVE___BUILTIN_ADD_OVERFLOW_P -DHAVE___BUILTIN_SUB_OVERFLOW_P -DHAVE_FUNC_ATTRIBUTE_CONST -DHAVE_FUNC_ATTRIBUTE_FLATTEN -DHAVE_FUNC_ATTRIBUTE_MALLOC -DHAVE_FUNC_ATTRIBUTE_PURE -DHAVE_FUNC_ATTRIBUTE_UNUSED -DHAVE_FUNC_ATTRIBUTE_WARN_UNUSED_RESULT -DHAVE_FUNC_ATTRIBUTE_WEAK -DHAVE_FUNC_ATTRIBUTE_FORMAT -DHAVE_FUNC_ATTRIBUTE_PACKED -DHAVE_FUNC_ATTRIBUTE_RETURNS_NONNULL -DHAVE_FUNC_ATTRIBUTE_ALIAS -DHAVE_FUNC_ATTRIBUTE_NORETURN -DHAVE_FUNC_ATTRIBUTE_OPTIMIZE -DHAVE_FUNC_ATTRIBUTE_COLD -DHAVE_FUNC_ATTRIBUTE_VISIBILITY -DHAVE_UINT128 -DHAVE_REALLOCARRAY -DHAVE_FMEMOPEN -D_GNU_SOURCE -DUSE_SSE41 -DHAVE___BUILTIN_IA32_CLFLUSHOPT -DUSE_GCC_ATOMIC_BUILTINS -DMAJOR_IN_SYSMACROS -DHAS_SCHED_H -DHAS_SCHED_GETAFFINITY -DHAVE_LINUX_FUTEX_H -DHAVE_ENDIAN_H -DHAVE_DLFCN_H -DHAVE_SYS_SHM_H -DHAVE_CET_H -DHAVE_SYS_INOTIFY_H -DHAVE_LINUX_UDMABUF_H -DHAVE_STRTOF -DHAVE_MKOSTEMP -DHAVE_MEMFD_CREATE -DHAVE_RANDOM_R -DHAVE_FLOCK -DHAVE_STRTOK_R -DHAVE_GETRANDOM -DHAVE_POSIX_FALLOCATE -DHAVE_SECURE_GETENV -DHAVE_SYSCONF -DHAVE_GNU_QSORT_R -DHAVE_STRUCT_TIMESPEC -DHAVE_PROGRAM_INVOCATION_NAME -DHAVE_ISSIGNALING -DHAVE_POSIX_MEMALIGN -DHAVE_DIRENT_D_TYPE -DHAVE_STRTOD_L -DHAVE_DLADDR -DHAVE_DL_ITERATE_PHDR -DHAVE_ZLIB -DHAVE_ZSTD -DHAVE_COMPRESSION -DHAVE_PTHREAD -DHAVE_PTHREAD_SETAFFINITY -DHAVE_LIBDRM -DHAVE_LIBUDEV '-DMESA_LLVM_VERSION_STRING="19.1.7"' -DLLVM_IS_SHARED=1 -DDRAW_LLVM_AVAILABLE=1 -DAMD_LLVM_AVAILABLE=1 -DGALLIVM_USE_ORCJIT=0 -DHAVE_SPIRV_TOOLS -DUSE_LIBELF -DHAVE_VALGRIND -DTHREAD_SANITIZER=0 -DHAVE_LIBUNWIND -DWL_HIDE_DEPRECATED -DHAVE_WL_DISPATCH_QUEUE_TIMEOUT -DHAVE_WL_CREATE_QUEUE_WITH_NAME -DHAVE_OPENMP -DXCB_KEYSYMS_AVAILABLE -DHAVE_X11_DRM -DHAVE_DRI -DHAVE_DRI2 -DHAVE_DRI3_EXPLICIT_SYNC -DHAVE_DRISW_KMS -DHAVE_GALLIUM_EXTRA_HUD=1 -DHAVE_LIBSENSORS=1 -mtls-dialect=gnu2 -Werror=return-type -Werror=empty-body -Wmisleading-indentation -Wno-error=maybe-uninitialized -Wno-non-virtual-dtor -Wno-missing-field-initializers -Wno-format-truncation -fno-math-errno -fno-trapping-math -flifetime-dse=1 -Wno-unknown-pragmas -Werror=format -Wformat-security -ffunction-sections -fdata-sections -Wno-unused-variable -Wno-unused-but-set-variable -std=c++17 -pipe -march=native -O2 -mfpmath=sse -fPIC -DVK_USE_PLATFORM_XCB_KHR -DVK_USE_PLATFORM_XLIB_KHR -DVK_USE_PLATFORM_WAYLAND_KHR -DVK_USE_PLATFORM_DISPLAY_KHR -DVK_USE_PLATFORM_XLIB_XRANDR_EXT -pthread -MD -MQ src/gallium/drivers/zink/libzink.a.p/zink_draw.cpp.o -MF src/gallium/drivers/zink/libzink.a.p/zink_draw.cpp.o.d -o src/gallium/drivers/zink/libzink.a.p/zink_draw.cpp.o -c ../../../src/gallium/drivers/zink/zink_draw.cpp
during GIMPLE pass: einline
../../../src/gallium/drivers/zink/zink_draw.cpp: In function ‘void zink_draw(pipe_context*, const pipe_draw_info*, unsigned int, const pipe_draw_indirect_info*, const pipe_draw_start_count_bias*, unsigned int, pipe_vertex_state*, uint32_t) [with zink_multidraw HAS_MULTIDRAW = ZINK_MULTIDRAW; zink_dynamic_state DYNAMIC_STATE = ZINK_DYNAMIC_STATE2; bool BATCH_CHANGED = false; bool DRAW_STATE = false]’:
../../../src/gallium/drivers/zink/zink_draw.cpp:671:49: internal compiler error: Segmentation fault
671 | if (drawid_broken != zink_get_last_vertex_key(ctx)->push_drawid)
| ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
0x7fc62aa02def ???
./signal/../sysdeps/unix/sysv/linux/x86_64/libc_sigaction.c:0
0x7fc62a9ecca7 __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:58
0x7fc62a9ecd64 __libc_start_main_impl
../csu/libc-start.c:360
Please submit a full bug report, with preprocessed source (by using -freport-bug).
Please include the complete backtrace with any bug report.
See <file:///usr/share/doc/gcc-15/README.Bugs> for instructions.
```
Another one that fails in a similar manner:
```
../../../src/mesa/vbo/vbo_attrib_tmp.h: In function ‘_mesa_ColorP3uiv’:
../../../src/mesa/vbo/vbo_exec_api.c:490:11: internal compiler error: Segmentation fault
490 | struct vbo_exec_context *exec = &vbo_context(ctx)->exec; \
```
mesa git at commit 3eef0c02453b59ed6380338fde8edd3063dd4227
The build process (as well as installing some dependencies using sudo),
can be replicated using this script at
https://gist.github.com/baryluk/1041204eff4cc4fad6f1508afe67b562
Then running it with `./mesa-build.py --build32=0 --debug=1` as a normal
user (it will create two directories `~/libdrm-git` and `~/mesa-git`,
and if build is successfull also `~/mesa-opt` and `~/zink-opt` script).
It will not modify or create any other files on system or user.
Few other files do also take forever to compile. Like 10 minutes, where
before it was few seconds. I never managed to wait long enough for it to
finish. Examples are `../../../src/mesa/vbo/vbo_save_api.c`
`../../../src/mesa/main/format_utils.c` but there are few more.
It is regression, as it was building all fine just few hours ago, before
I did system upgrade.
Here is a dump of the build script, showing some dependencies versions
user@debian:~$ ./mesa-build.py --build32=0 --debug=1 --git-pull=0
Checking base dependency versions on amd64 ...
Running sudo --preserve-env=DEBIAN_FRONTEND,APT_LISTCHANGES_FRONTEND,NEEDRESTART_MODE,NEEDRESTART_SUSPEND,DEBIAN_FRONT apt-get install --option APT::Get::HideAutoRemove=1 --option quiet::NoProgress=1 --no-install-recommends libc6-dev:amd64
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libc6-dev is already the newest version (2.41-12).
Solving dependencies... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Ensuring dependencies for Mesa build are installed ...
Running sudo --preserve-env=DEBIAN_FRONTEND,APT_LISTCHANGES_FRONTEND,NEEDRESTART_MODE,NEEDRESTART_SUSPEND,DEBIAN_FRONT apt-get install --option APT::Get::HideAutoRemove=1 --option quiet::NoProgress=1 --no-install-recommends mesa-utils vulkan-tools git ca-certificates gcc-15 g++-15 pkg-config meson ninja-build gettext python3 python3-setuptools python3-mako valgrind bison flex dpkg-dev glslang-tools libclang-19-dev:amd64 libclang-cpp19-dev libclc-19-dev libpolly-19-dev:amd64 xutils-dev:amd64 bindgen cbindgen rustfmt librust-paste-dev librust-syn-dev libvulkan-dev:amd64 libxv-dev:amd64 libva-dev:amd64 zlib1g-dev:amd64 libzstd-dev:amd64 libexpat1-dev:amd64 libelf-dev:amd64 libglvnd-dev:amd64 wayland-protocols:amd64 libwayland-dev:amd64 libwayland-egl-backend-dev:amd64 libx11-dev:amd64 libxext-dev:amd64 libxfixes-dev:amd64 libxcb-glx0-dev:amd64 libxcb-shm0-dev:amd64 libxcb1-dev:amd64 libx11-xcb-dev:amd64 libxcb-dri2-0-dev:amd64 libxcb-dri3-dev:amd64 libxcb-present-dev:amd64 libxcb-sync-dev:amd64 libxcb-keysyms1-dev:amd64 libxshmfence-dev:amd64 x11proto-dev:amd64 libxxf86vm-dev:amd64 libxcb-xfixes0-dev:amd64 libxcb-randr0-dev:amd64 libxrandr-dev:amd64 libxcb-sync-dev:amd64 libsensors-dev:amd64 libx11-dev:amd64 libudev-dev:amd64 libpciaccess-dev:amd64 libcunit1-dev:amd64 liblua5.4-dev:amd64 libcairo-dev:amd64 libllvmspirvlib-19-dev:amd64 llvm-spirv-19:amd64 wayland-protocols libwayland-bin
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'libcairo2-dev' instead of 'libcairo-dev'
mesa-utils is already the newest version (9.0.0-2+b2).
vulkan-tools is already the newest version (1.4.328.1+dfsg1-1).
git is already the newest version (1:2.51.0-1).
ca-certificates is already the newest version (20250419).
gcc-15 is already the newest version (15.2.0-7).
g++-15 is already the newest version (15.2.0-7).
pkg-config is already the newest version (1.8.1-4).
meson is already the newest version (1.9.1-2).
ninja-build is already the newest version (1.13.1-1).
gettext is already the newest version (0.23.2-1).
python3 is already the newest version (3.13.7-1).
python3-setuptools is already the newest version (78.1.1-0.1).
python3-mako is already the newest version (1.3.10-3).
valgrind is already the newest version (1:3.25.1-3).
bison is already the newest version (2:3.8.2+dfsg-1+b2).
flex is already the newest version (2.6.4-8.2+b4).
dpkg-dev is already the newest version (1.22.21).
glslang-tools is already the newest version (15.4.0-1).
libclang-19-dev is already the newest version (1:19.1.7-10.1).
libclang-cpp19-dev is already the newest version (1:19.1.7-10.1).
libclc-19-dev is already the newest version (1:19.1.7-10.1).
libpolly-19-dev is already the newest version (1:19.1.7-10.1).
xutils-dev is already the newest version (1:7.7+7).
bindgen is already the newest version (0.72.1-1).
cbindgen is already the newest version (0.27.0-2).
rustfmt is already the newest version (1.90.0+dfsg1-1).
librust-paste-dev is already the newest version (1.0.15-1).
librust-syn-dev is already the newest version (2.0.105-1).
libvulkan-dev is already the newest version (1.4.328.1-1).
libxv-dev is already the newest version (2:1.0.13-1).
libva-dev is already the newest version (2.22.0-3).
zlib1g-dev is already the newest version (1:1.3.dfsg+really1.3.1-1+b1).
libzstd-dev is already the newest version (1.5.7+dfsg-2).
libexpat1-dev is already the newest version (2.7.3-1).
libelf-dev is already the newest version (0.194-1).
libglvnd-dev is already the newest version (1.7.0-1+b2).
wayland-protocols is already the newest version (1.45-2).
libwayland-dev is already the newest version (1.24.0-2+b1).
libwayland-egl-backend-dev is already the newest version (1.24.0-2+b1).
libx11-dev is already the newest version (2:1.8.12-1).
libxext-dev is already the newest version (2:1.3.4-1+b3).
libxfixes-dev is already the newest version (1:6.0.0-2+b4).
libxcb-glx0-dev is already the newest version (1.17.0-2+b1).
libxcb-shm0-dev is already the newest version (1.17.0-2+b1).
libxcb1-dev is already the newest version (1.17.0-2+b1).
libx11-xcb-dev is already the newest version (2:1.8.12-1).
libxcb-dri2-0-dev is already the newest version (1.17.0-2+b1).
libxcb-dri3-dev is already the newest version (1.17.0-2+b1).
libxcb-present-dev is already the newest version (1.17.0-2+b1).
libxcb-sync-dev is already the newest version (1.17.0-2+b1).
libxcb-keysyms1-dev is already the newest version (0.4.1-1).
libxshmfence-dev is already the newest version (1.3.3-1).
x11proto-dev is already the newest version (2024.1-1).
libxxf86vm-dev is already the newest version (1:1.1.4-2).
libxcb-xfixes0-dev is already the newest version (1.17.0-2+b1).
libxcb-randr0-dev is already the newest version (1.17.0-2+b1).
libxrandr-dev is already the newest version (2:1.5.4-1+b3).
libsensors-dev is already the newest version (1:3.6.2-2).
libudev-dev is already the newest version (259~rc1-1).
libpciaccess-dev is already the newest version (0.17-3+b3).
libcunit1-dev is already the newest version (2.1-3-dfsg-2.7+b1).
liblua5.4-dev is already the newest version (5.4.8-1).
libcairo2-dev is already the newest version (1.18.4-1+b1).
libllvmspirvlib-19-dev is already the newest version (19.1.12-1).
llvm-spirv-19 is already the newest version (19.1.12-1).
libwayland-bin is already the newest version (1.24.0-2+b1).
Solving dependencies... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Running sudo --preserve-env=DEBIAN_FRONTEND,APT_LISTCHANGES_FRONTEND,NEEDRESTART_MODE,NEEDRESTART_SUSPEND,DEBIAN_FRONT apt-get install --option APT::Get::HideAutoRemove=1 --option quiet::NoProgress=1 --no-install-recommends directx-headers-dev:amd64
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
directx-headers-dev is already the newest version (1.618.2-1).
Solving dependencies... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Attempting to install llvm19 ... If it fails, please read the source code how to add proper repos...
Running sudo --preserve-env=DEBIAN_FRONTEND,APT_LISTCHANGES_FRONTEND,NEEDRESTART_MODE,NEEDRESTART_SUSPEND,DEBIAN_FRONT apt-get install --option APT::Get::HideAutoRemove=1 --option quiet::NoProgress=1 --no-install-recommends libllvm19 libllvm19:amd64 llvm-19-dev
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libllvm19 is already the newest version (1:19.1.7-10.1).
llvm-19-dev is already the newest version (1:19.1.7-10.1).
Solving dependencies... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Running sudo --preserve-env=DEBIAN_FRONTEND,APT_LISTCHANGES_FRONTEND,NEEDRESTART_MODE,NEEDRESTART_SUSPEND,DEBIAN_FRONT apt-get install --option APT::Get::HideAutoRemove=1 --option quiet::NoProgress=1 --no-install-recommends libllvm19-dbgsym:amd64
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libllvm19-dbgsym is already the newest version (1:19.1.7-10.1).
Solving dependencies... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Checking libdrm git repo ...
libdrm-git repo already present. To update, use --git-pull=1 option or run "cd '/home/user/libdrm-git' && git pull" manually.
Checking mesa git repo ...
mesa-git repo already present. To update, use --git-pull=1 option or run "cd '/home/user/mesa-git' && git pull" manually.
Running sudo --preserve-env=DEBIAN_FRONTEND,APT_LISTCHANGES_FRONTEND,NEEDRESTART_MODE,NEEDRESTART_SUSPEND,DEBIAN_FRONT apt-get install --option APT::Get::HideAutoRemove=1 --option quiet::NoProgress=1 --no-install-recommends libclang-19-dev libclang-cpp19-dev:amd64
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libclang-19-dev is already the newest version (1:19.1.7-10.1).
libclang-cpp19-dev is already the newest version (1:19.1.7-10.1).
Solving dependencies... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Configuring and building amd64 opt Mesa ...
-- System Information:
Debian Release: forky/sid
APT prefers testing-debug
APT policy: (500, 'testing-debug'), (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 6.18.0-rc6 (SMP w/32 CPU threads; PREEMPT)
Kernel taint flags: TAINT_CPU_OUT_OF_SPEC, TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages g++-15-x86-64-linux-gnu depends on:
ii gcc-15-base 15.2.0-7
ii gcc-15-x86-64-linux-gnu 15.2.0-7
ii libc6 2.41-12
ii libgmp10 2:6.3.0+dfsg-5
ii libisl23 0.27-1
ii libmpc3 1.3.1-2
ii libmpfr6 4.2.2-2
ii libstdc++-15-dev 15.2.0-7
ii libzstd1 1.5.7+dfsg-2
ii zlib1g 1:1.3.dfsg+really1.3.1-1+b1
g++-15-x86-64-linux-gnu recommends no packages.
Versions of packages g++-15-x86-64-linux-gnu suggests:
pn gcc-15-doc <none>
-- no debconf information
Reply to: