This is the mail archive of the
mailing list for the glibc project.
Re: [PATCH 1/2] Replace check_mul_overflow_size_t with INT_MULTIPLY_WRAPV
- From: Paul Eggert <eggert at cs dot ucla dot edu>
- To: Florian Weimer <fw at deneb dot enyo dot de>, Adhemerval Zanella <adhemerval dot zanella at linaro dot org>
- Cc: libc-alpha at sourceware dot org
- Date: Sat, 22 Dec 2018 22:55:11 -0800
- Subject: Re: [PATCH 1/2] Replace check_mul_overflow_size_t with INT_MULTIPLY_WRAPV
- References: <email@example.com> <firstname.lastname@example.org>
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.