fix uninitialized array in constexpr context (GCC 14)#669
Merged
kris-jusiak merged 1 commit intoMay 23, 2026
Merged
Conversation
state_t old[regions] was declared without initialization, which is invalid
in a constexpr function under GCC 14's stricter enforcement. Zero-initialize
both occurrences with {} — state_t is an integer type so this is correct
and efficient.
Also add issue_639_repro to the CMake test list with -ftemplate-depth=100
so the template depth regression test runs in CI (previously only in Make).
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.
Problem
Two
state_t old[regions]declarations insm_impl::process_eventand the deferred-event dispatch were uninitialized at the point of declaration. GCC 14 enforces that constexpr functions cannot contain uninitialized local variables, causing theconstexpr_smtest to fail with:Fix
Zero-initialize both occurrences with
{}:state_tis always an integer type (unsigned charorunsigned short), so{}gives correct zero-initialization with no overhead.Also included
Adds
issue_639_repro.cppto the CMake test configuration with-ftemplate-depth=100, so the template depth regression test from issue #639 runs in CI (it was previously only present in the Makefile).Closes the GCC 14 constexpr failure visible when running
make test CXX=g++ CXXSTD=c++17locally.