This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Request to merge Undefined Behavior Sanitizer in


On Thu, 25 Jul 2013, Marek Polacek wrote:

> +@item -fsanitize=undefined
> +Enable UndefinedBehaviorSanitizer, a fast undefined behavior detector
> +Various computations will be instrumented to detect
> +undefined behavior, e.g.@: division by zero or various overflows.

The same issues applies as for bounds-checking options - please give 
sufficient information in the documentation for a user to be able to judge 
the trade-offs between this and -ftrapv (for example).

It should also be clear how this interacts with -fwrapv.  I'd say that 
-fwrapv makes the semantics of overflow in signed-integer arithmetic no 
longer undefined (of course division by zero is still undefined) and so 
should mean such overflows aren't warned for.  Now, you don't currently 
have any checks this would affect (given that INT_MIN / -1 and INT_MIN % 
-1 don't currently work reliably with -fwrapv anyway), but the intention 
should be clear for when overflow checks are added.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]