On Mon, 18 Nov 2013, Marek Polacek wrote:
> +@item @option{-fsanitize=shift}
> +
> +This option enables checking that the result of a shift operation is
> +not undefined. Note that what exactly is considered undefined differs
> +slightly between C and C++, as well as between ANSI C and C99, etc.
We generally refer to ISO C90, not ANSI C.
> +Detect integer division by zero as well as @code{INT_MIN / -1} division.
> +Note that the latter is only made undefined from C99 onwards.
INT_MIN / -1 is unambiguously undefined in C90 - it's a signed arithmetic
overflow (result not within the range of its type). It's INT_MIN % -1
where there's more ambiguity, but I consider the wording changes in C11 as
a defect correction that should be applied back to C90. (A comment on
what the semantics should be, not on whether the documentation accurately
reflects the code.)
--
Joseph S. Myers
[email protected]