[PATCH 1/2] Replace check_mul_overflow_size_t with INT_MULTIPLY_WRAPV

Paul Eggert eggert@cs.ucla.edu
Mon Dec 24 22:10:00 GMT 2018


Florian Weimer wrote:
>> -  bool overflow = check_mul_overflow_size_t (element_size, count, &size);
>> +  bool overflow = INT_MULTIPLY_WRAPV (element_size, count, &size);
> What's the reason for not using the compiler built-in?

Presumably Adhemerval wrote that patch before Joseph's commit yesterday that 
bumped glibc's minimum GCC requirement from GCC 4.9 to GCC 5. But you're right, 
now that we're requiring GCC 5 the code can use __builtin_mul_overflow instead 
of INT_MULTIPLY_WRAPV. And using the builtin would address DJ's concern as well. 
So it would be better to redo the patch that way.



More information about the Libc-alpha mailing list