On Mon, 21 Jan 2019, Dariusz Sendkowski wrote: > Wouldn't it lead to undefined behavior? > According to the standard: "... The value of the result of an integer > arithmetic or conversion function cannot be represented (7.8.2.1, 7.8.2.2, > 7.8.2.3, 7.8.2.4, 7.22.6.1, 7.22.6.2, 7.22.1) ..." > This dump case is not compiled with -fwrapv flag, so I guess it might lead > to undefined behavior.
OpenBSD sets -fwrapv by default. From clang-local(1): - The -fwrapv option to treat signed integer overflows as defined is enabled by default to prevent dangerous optimizations which could remove security critical overflow checks.