Linus Cc:-ed so he can chime in if he wants to.

Thanks,

        Ingo

* Rasmus Villemoes <[email protected]> wrote:

> On Mon, Jul 20 2015, Sasha Levin <[email protected]> wrote:
> 
> > On 07/19/2015 07:17 PM, Rasmus Villemoes wrote:
> >> Last year, Sasha Levin suggested adding wrappers for the
> >> __builtin_*_overflow functions introduced with gcc 5.1 (based on
> >> similar, but type-specific, functions in clang). This is another
> >> attempt at providing such wrappers and fallback code for older compilers.
> >
> > What's the difference between this version and the one Linus essentially
> > rejected?
> 
> Assuming you're referring to
> http://thread.gmane.org/gmane.linux.kernel/1838832 (the latest I could
> find, and the one Linus "[didn't] like"):
> 
> I've tried to ensure that the fallback code has the same semantics as
> the gcc builtins [1] (in particular, to handle all kinds of overflow) -
> I think it would be rather dangerous if the types of overflow detected
> depended on the gcc version.
> 
> The fallback code in the version referred to above had a number of
> problems:
> 
> * relies on UB for signed types
> 
> * both false positives and false negatives (because it more or less
>   implicitly assumed that all values are positive)
> 
> * even for unsigned types, plain a+b<a is broken for types narrower than
>   int
> 
> It's also inconvenient for the user to have to pass the appropriate
> type_max value to the mul_overflow checker. 
> 
> Rasmus
> 
> [1] though with the extra requirement of all three arguments having the
> same type.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to