Skip to content

build: gcc 15 hits the same -Warray-bounds false positive, so widen the demotion guard - #1293

Merged
localai-bot merged 2 commits into
mudler:mainfrom
joral:fix/gcc15-array-bounds
Aug 21, 2026
Merged

build: gcc 15 hits the same -Warray-bounds false positive, so widen the demotion guard#1293
localai-bot merged 2 commits into
mudler:mainfrom
joral:fix/gcc15-array-bounds

Conversation

@joral

@joral joral commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

The guard added the -Wno-error=array-bounds escape hatch for GCC >= 16 only, and
its comment asserted that everything at or below 15 still fails the build on a
real out-of-bounds. gcc 15.2.0 reproduces the same false-positive class from the
other libstdc++ container: std::vector's inlined copy-construct plus
_M_allocate, reported at ltx2_samplers.cpp:161,163 against a bound of
float[2305843009213693951]. That bound is SIZE_MAX/4, the allocator's
unconstrained size range rather than a real object, which is the inlining
attribution the guard's own comment already documents for _M_release. The
subscripts are sigmas.back() on a copy of a container that VT_CHECK proves holds
at least two elements three lines above, and GCC does not propagate that
throwing check through the inlined copy.

main therefore did not build on gcc 15.x at all, stopping at 146/1552, and no CI
lane covers the release: the matrix is gcc 13 on every ordinary Linux lane and
gcc 16 in build-newest-gcc, which the guard already exempts, so the failure sits
exactly between the two points. gcc 15 is the current toolchain on Arch, NixOS
unstable and Fedora 42.

Measured on 4ee5f4a with gcc 15.2.0: the translation unit is exit 1 with two
-Werror=array-bounds= errors, and exit 0 with the same two as warnings once the
guard applies, so the diagnostic stays visible exactly as intended.
scripts/agent-preflight.sh fails the identical 10 gates before and after.

Whether CI should also cover gcc 14 and 15 is a separate question and is
deliberately not bundled here, because the widened guard already prevents this
defect recurring and a lane would guard a different class.

Closes #1292

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: Claude:claude-sonnet-5 [Claude Code]

@localai-org-maint-bot

Copy link
Copy Markdown
Collaborator

The GCC 15 diagnosis and version-gate change look correct, but this branch is currently conflicting with main. Please rebase it onto current main; after that, the focused GCC 15 red/green evidence should make this ready for a merge ping.

@joral
joral force-pushed the fix/gcc15-array-bounds branch 2 times, most recently from 4145acb to a277ac1 Compare August 19, 2026 17:49
…he demotion guard

The guard added the -Wno-error=array-bounds escape hatch for GCC >= 16 only, and
its comment asserted that everything at or below 15 still fails the build on a
real out-of-bounds. gcc 15.2.0 reproduces the same false-positive class from the
other libstdc++ container: std::vector<float>'s inlined copy-construct plus
_M_allocate, reported at ltx2_samplers.cpp:161,163 against a bound of
float[2305843009213693951]. That bound is SIZE_MAX/4, the allocator's
unconstrained size range rather than a real object, which is the inlining
attribution the guard's own comment already documents for _M_release. The
subscripts are sigmas.back() on a copy of a container that VT_CHECK proves holds
at least two elements three lines above, and GCC does not propagate that
throwing check through the inlined copy.

main therefore did not build on gcc 15.x at all, stopping at 146/1552, and no CI
lane covers the release: the matrix is gcc 13 on every ordinary Linux lane and
gcc 16 in build-newest-gcc, which the guard already exempts, so the failure sits
exactly between the two points. gcc 15 is the current toolchain on Arch, NixOS
unstable and Fedora 42.

Measured on 4ee5f4a with gcc 15.2.0: the translation unit is exit 1 with two
-Werror=array-bounds= errors, and exit 0 with the same two as warnings once the
guard applies, so the diagnostic stays visible exactly as intended.
scripts/agent-preflight.sh fails the identical 10 gates before and after.

Whether CI should also cover gcc 14 and 15 is a separate question and is
deliberately not bundled here, because the widened guard already prevents this
defect recurring and a lane would guard a different class.

Closes mudler#1292

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: Claude:claude-sonnet-5 [Claude Code]
@joral
joral force-pushed the fix/gcc15-array-bounds branch from a277ac1 to ebf96e3 Compare August 20, 2026 12:43
@joral

joral commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

Rebased as requested. The remaining red does not come from this change.

I rebased onto c8d926ea8. The conflict cleared and the pull request reached MERGEABLE. Main then advanced to 5870cb2b, and the branch returned to CONFLICTING. Main stands at aee6c48d6 now.

Facts:

Inference: a one-line Markdown addition cannot fail five model tests. The red comes from the base.

The same file explains the conflict. GitHub does not apply the merge=union driver when it computes mergeability, so each merge returns every other open pull request to CONFLICTING. Main moves faster than one ci cycle, which cuda-fat-build alone extends to 1 hour 40 minutes. I can rebase again on request, but I am worried the same result would follow.

Brings the branch to current main so the union merge driver resolves the
issue-index append locally. GitHub's server-side merge does not apply custom
merge drivers, which is the only reason the pull request read CONFLICTING.

FOLLOWING_AGENTS_PROTOCOL

Following-Agents-Protocol: true
AI-Assisted: true
Assisted-by: Claude:claude-opus-5 [Claude Code]
@localai-bot
localai-bot merged commit e05911f into mudler:main Aug 21, 2026
2 of 25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

main does not build on gcc 15.x — the -Warray-bounds error demotion is gated at GCC >= 16

4 participants