Skip to content

Fix GCC 14 -Wstringop-overflow warnings on ppc64le#1077

Open
runlevel5 wants to merge 1 commit into
RobertBeckebans:masterfrom
runlevel5:fix/gcc14-stringop-overflow-warnings
Open

Fix GCC 14 -Wstringop-overflow warnings on ppc64le#1077
runlevel5 wants to merge 1 commit into
RobertBeckebans:masterfrom
runlevel5:fix/gcc14-stringop-overflow-warnings

Conversation

@runlevel5

@runlevel5 runlevel5 commented Feb 13, 2026

Copy link
Copy Markdown

Summary

  • neo/idlib/Swap.h: Use C++17 if constexpr in idSwap::Big() so the compiler discards dead branches at compile time, preventing false positive -Wstringop-overflow warnings when GCC inlines and analyzes out-of-bounds accesses in branches that can never execute (e.g. the sizeof(type) == 8 branch for a 4-byte float). Also replaced the runtime assert(false) fallback with static_assert for a compile-time error on unsupported type sizes.
  • neo/d3xp/gamesys/SysCmds.cpp: Cast idStr::snPrintf() return value to unsigned int in PrintFloat() to tell the compiler the value cannot be negative (buf is 128 bytes, format string is fixed), preventing a false positive -Wstringop-overflow warning when GCC inlines PrintFloat into Cmd_ListDebugLines_f and considers a negative index path.

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.

1 participant