https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86471

--- Comment #8 from Matt Bentley <mattreecebentley at gmail dot com> ---
> This is incorrect for floating point types and non scalars.  And it
> introduces an extra check at runtime if value is not known to compile time.

This is the overload for scalar types, read the function description line.
The extra check is negligible compared to the overhead caused by the
alternative looping code vs memset, as is benchmarked above.

I had to read up on how floating-point is implementation-defined, so yes you're
right, the specialization would have to be further constricted to integral and
scalar pointer types using __is_integral_helper & __is_scalar.
Whether the commonality of zero-wiping newly allocated arrays outweights the
overhead of an additional check for non-zero fills, is a good question.

Reply via email to