Skip to content

Fix GCC -Wstringop-overflow warnings in Swap.h and SysCmds.cpp#1072

Closed
runlevel5 wants to merge 1 commit into
RobertBeckebans:masterfrom
runlevel5:fix/gcc-warnings
Closed

Fix GCC -Wstringop-overflow warnings in Swap.h and SysCmds.cpp#1072
runlevel5 wants to merge 1 commit into
RobertBeckebans:masterfrom
runlevel5:fix/gcc-warnings

Conversation

@runlevel5

@runlevel5 runlevel5 commented Feb 8, 2026

Copy link
Copy Markdown

Use if constexpr in idSwap::Big() so the compiler discards dead branches for mismatched sizeof(type), preventing false-positive out-of-bounds access warnings when inlined.

Guard PrintFloat against negative snPrintf return value to prevent GCC from warning about out-of-bounds buf[] writes when inlined.

Fixes #1043

Use if constexpr in idSwap::Big() so the compiler discards dead
branches for mismatched sizeof(type), preventing false-positive
out-of-bounds access warnings when inlined.

Guard PrintFloat against negative snPrintf return value to prevent
GCC from warning about out-of-bounds buf[] writes when inlined.
@SRSaunders

Copy link
Copy Markdown

See my comments in #1043.

@runlevel5

Copy link
Copy Markdown
Author

Closed in favor of #1077

@runlevel5 runlevel5 closed this Feb 13, 2026
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.

[Linux][ppc64le] -Wstringop-overflow warnings with gcc 14

2 participants