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).
> diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
> index d874dd65f11..6398b142047 100644
> --- a/gcc/doc/invoke.texi
> +++ b/gcc/doc/invoke.texi
> @@ -19276,7 +19276,11 @@ 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 Kernels view of what C is. It does @strong{not} turn pointers
s/Kernels/Kernel's/
> +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
> --
> 2.51.0
Jakub