[Bug middle-end/86471] GCC/libstdc++ outputs inferior code for std::fill and std::fill_n vs std::memset on c-style arrays
mattreecebentley at gmail dot com
gcc-bugzilla@gcc.gnu.org
Wed Jul 18 03:35:00 GMT 2018
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86471
--- Comment #20 from Matt Bentley <mattreecebentley at gmail dot com> ---
(In reply to Matt Bentley from comment #19)
> (In reply to Jonathan Wakely from comment #18)
> > (In reply to Matt Bentley from comment #13)
> > > Well it's more that you're doing- at any rate, the issue you've noted is
> > > easily bypassed by changing the "reinterpret_cast<void *>(__first)" to
> > > "reinterpret_cast<void *>(&*(__first))".
> >
> > Also, independent of the non-contiguous problem, using reinterpret_cast here
> > is unnecessary (any non-const pointer can be implicitly converted to void*)
> > and would prevent adding constexpr to the algorithm (as required for C++2a).
>
> It is to prevent compiler warnings under clang.
Actually, don't quote me on that - I may be thinking of the
'reinterpret_cast<_Tp>(0)' - one of the two.
More information about the Gcc-bugs
mailing list