[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
Tue Jul 17 00:05:00 GMT 2018


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

--- Comment #16 from Matt Bentley <mattreecebentley at gmail dot com> ---
(In reply to Jonathan Wakely from comment #15)

> Look at how this exact problem is already solved elsewhere in the same file.
> All the algorithms that dispatch to a __builtin_memxxx function use similar
> techniques, detecting when the iterators are pointers for a start.

Yup - arguably it would be nice to have an overload for vector iterators that
does the same thing.


> And see https://gcc.gnu.org/contribute.html#legal for why code pasted into
> bugzilla without the necessary paperwork is unhelpful (and possibly even
> counter-productive if we end up having to re-invent the same wheel without
> using your code).

I've read it, it says copyright assignments are unneeded for small
contributions. Also, this wasn't patch code, just spitballing code.


> Indeed. It's a forward iterator. Even a random access iterator doesn't
> guarantee you can do that (e.g. std::deque::iterator is random access but
> not contiguous).

Yep, got it.


More information about the Gcc-bugs mailing list