https://gcc.gnu.org/g:9bb79eb94eded396a50af9460ea66c2faffe1fad
commit r17-4561-g9bb79eb94eded396a50af9460ea66c2faffe1fad Author: Richard Biener <[email protected]> Date: Tue Sep 22 14:13:30 2026 +0200 tree-optimization/127497 - add disclaimer to -fwrapv-pointer docs This adds a disclaimer discouraging use of -fwrapv-pointer. * doc/invoke.texi (fwrapv-pointer): Add disclaimer. (fno-strict-overflow): Discourage, suggest fwrapv. Diff: --- gcc/doc/invoke.texi | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi index 498a3608151e..20d82c620f67 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -19270,13 +19270,19 @@ results in @option{-ftrapv} being effective. This option instructs the compiler to assume that pointer arithmetic overflow on addition and subtraction wraps around using twos-complement representation. This flag disables some optimizations which assume -pointer overflow is invalid. +pointer overflow is invalid. @strong{Warning:} this option exists because +of the Linux Kernel's view of what C is. It does @strong{not} turn pointers +into twos-complement numbers or eliminates all rules and guarantees the C +standard has on pointers. @strong{Do not use} this option but rather write +conforming C. @opindex fstrict-overflow @opindex fno-strict-overflow @item -fstrict-overflow This option implies @option{-fno-wrapv} @option{-fno-wrapv-pointer} and when -negated implies @option{-fwrapv} @option{-fwrapv-pointer}. +negated implies @option{-fwrapv} @option{-fwrapv-pointer}. You should +consider using @code{-fwrapv} instead of @code{-fstrict-overflow}, +the (implicit) use of @code{-fwrapv-pointer} is discouraged. @opindex fexceptions @opindex fno-exceptions
