Repository navigation
Work around GCC miscompiling the provider lists - #730
Merged
arch1t3cht merged 1 commit intoOct 9, 2026
Merged
arch1t3cht merged 1 commit into
arch1t3cht merged 1 commit into
Conversation
GCC miscompiles a namespace-scope std::initializer_list whose elements are a mix of constant-initializable and non-constant ones: the static initializer leaves the constant ones zeroed (https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126472). Since TypesettingTools#655 added the extensions vector, the Dummy entries of the audio and video provider lists are such elements in C++20, where std::vector's default constructor is constexpr. With an affected GCC (at least 13 through 16.2; fixed for 16.3), every attempt to open audio or video therefore dereferences a null provider name and crashes. A std::vector is initialized correctly. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CoffeeFlux
force-pushed
the
fix/gcc-provider-list-miscompile
branch
from
October 8, 2026 21:06
39d33b8 to
8503fe3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since #655 added the
extensionsvector to the audio and video provider factories, Linux builds of master made with GCC crash whenever they open audio or video. No release is affected, since #655 landed after 3.5.0, and the Windows (MSVC) and macOS (clang) builds are fine.Cause
This is GCC bug 126472: when a namespace-scope
std::initializer_listmixes elements that can be constant-initialized with ones that can't, the static initializer leaves the constant ones zeroed. In C++20,std::vector's default constructor isconstexpr, so ourDummyentries (with an emptyextensionslist) are constant while the others, whose lists need a heap allocation, aren't. TheDummyentries therefore end up with a nullname, andGetSortedcrashes comparing the preferred provider's name against it.Minimal reproducer:
-std=c++20)(null) b-std=c++17a ba bThe GCC fix (126335) is on trunk and was backported for 16.3, but not to 15 or earlier, so e.g. Ubuntu 24.04's default GCC 13 (which our Linux CI uses) will keep miscompiling this.
Fix
Store both lists in a
std::vector, which every compiler above initializes correctly, and leave a comment linking the GCC bug so they don't get turned back intoinitializer_lists.Why CI didn't catch it
Master's Linux CI does build with the affected GCC 13.3, but none of its tests open audio or video: the gtest suite only links
libaegisub, and the provider lists live insrc/. It showed up in #670, whose end-to-end CLI tests are the first to load a video. There it crashed on every--video, including a missing file, and the tests pass in an Ubuntu 24.04 container (GCC 13.3) with this change. I haven't run the GUI from master on Linux, but the failing code runs during static initialization, before anything CLI-specific.🤖 Generated with Claude Code