Enable -fwrapv by default with clang to treat signed integer overflows
authorjsg <jsg@openbsd.org>
Tue, 6 Jun 2017 09:40:24 +0000 (09:40 +0000)
committerjsg <jsg@openbsd.org>
Tue, 6 Jun 2017 09:40:24 +0000 (09:40 +0000)
commit7b4a6572144bf7b3a2d98f06f0d85f1eb74d6bc8
treec51267c1f09bae079b691195e94ca99c1f34f4c2
parentc4bd6d35a90a1f912559bf316a3ac99b306972c9
Enable -fwrapv by default with clang to treat signed integer overflows
as defined.  This is done to prevent dangerous optimisations which could
remove security critical overflow checks.

Base gcc has -fno-strict-overflow by default, with clang this is
identical to -fwrapv.

Prompted by naddy@ discovering a hang with a clang compiled i386 kernel
that was resolved with -fwrapv.

ok kettenis@ pascal@
gnu/llvm/tools/clang/lib/Driver/Tools.cpp