kees 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.

Right. `-fwrapv` defines the signed integer overflow resolution strategy. 
Without `-fwrapv` it is undefined (default language feature). With `-fwrapv` it 
is defined as 2s-complement wrap-around (and is well defined, like unsigned 
integer overflow).

https://github.com/llvm/llvm-project/pull/80089
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to