On Tue, 22 Sep 2026, Jakub Jelinek wrote: > On Tue, Sep 22, 2026 at 02:16:27PM +0200, Richard Biener wrote: > > This adds a disclaimer discouraging use of -fwrapv-pointer. > > > > Built docs and inspected pdf. > > > > OK? > > > > Thanks, > > Richard. > > > > * doc/invoke.texi (fwrapv-pointer): Add disclaimer. > > LGTM (though maybe we should point to that also in the -fno-strict-overflow > case (which implies it).
Like this? >From b8db184c75da82e0de4cb43667714c56c1cba519 Mon Sep 17 00:00:00 2001 From: Richard Biener <[email protected]> Date: Tue, 22 Sep 2026 14:13:30 +0200 Subject: [PATCH] tree-optimization/127497 - add disclaimer to -fwrapv-pointer docs To: [email protected] This adds a disclaimer discouraging use of -fwrapv-pointer. * doc/invoke.texi (fwrapv-pointer): Add disclaimer. (fno-strict-overflow): Discourage, suggest fwrapv. --- 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 d874dd65f11..ed91476a604 100644 --- a/gcc/doc/invoke.texi +++ b/gcc/doc/invoke.texi @@ -19276,13 +19276,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 -- 2.51.0
