[clang] [compiler-rt] [Sanitizer] add signed-integer-wrap sanitizer (PR #80089)

John McCall via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 14 14:30:25 PST 2024


rjmccall wrote:

> > > > Why not just enforce -fsanitize=signed-integer-overflow with -fwrapv? I suspect it's just overlook, and not intentional behavior.
> > > 
> > > 
> > > +1
> > > We should consider this direction
> > 
> > 
> > The UB-vs-non-UB seemed to be a really specific goal in the existing code. i.e. that the sanitizer was disabled didn't look like an accident. For people using this to find _only_ UB, this would be a behavioral change, so to me it seems like a separate name makes the most sense. Anyone wanting wrap-around checking can use -wrap, and anyone wanting UB checking can use -overflow.
> 
> Isn't this still UB even with -fwrapv? UB is a language feature, not compiler.

`-fwrapv` is essentially a language dialect that defines the behavior of integer wraparound.  It is no longer UB in compilations using that mode.

https://github.com/llvm/llvm-project/pull/80089


More information about the cfe-commits mailing list