When deciding whether to perform the memset optimization in ranges::fill_n, we were crucially neglecting to check that the output pointer's value type is a byte type. This patch adds such a check to the problematic condition in ranges::fill_n. At the same time, this patch relaxes the overly conservative __is_byte<_Tp>::__value check that requires the fill type be a byte type. It's overly conservative because it means we won't enable the memset optimization in the following example char c[100]; ranges::fill(c, 37); because the fill type is deduced to be int here. Rather than requiring that the fill type be a byte type, it seems safe to just require the fill type be an integral type, which is what this patch does. libstdc++-v3/ChangeLog: PR libstdc++/94017 * include/bits/ranges_algobase.h (__fill_n_fn::operator()): Refine condition for when to use memset, making sure to additionally check that the output pointer's value type is a non-volatile byte type. Instead of requiring that the fill type is a byte type, just require that it's an integral type. * testsuite/20_util/specialized_algorithms/uninitialized_fill/94017.cc: New test. * testsuite/20_util/specialized_algorithms/uninitialized_fill_n/94017.cc: New test. * testsuite/25_algorithms/fill/94013.cc: Uncomment part that was blocked by PR 94017. * testsuite/25_algorithms/fill/94017.cc: New test. * testsuite/25_algorithms/fill_n/94017.cc: New test.
Name |
Last commit
|
Last update |
---|---|---|
.. | ||
config | Loading commit data... | |
doc | Loading commit data... | |
include | Loading commit data... | |
libsupc++ | Loading commit data... | |
po | Loading commit data... | |
python | Loading commit data... | |
scripts | Loading commit data... | |
src | Loading commit data... | |
testsuite | Loading commit data... | |
ChangeLog | Loading commit data... | |
ChangeLog-1998 | Loading commit data... | |
ChangeLog-1999 | Loading commit data... | |
ChangeLog-2000 | Loading commit data... | |
ChangeLog-2001 | Loading commit data... | |
ChangeLog-2002 | Loading commit data... | |
ChangeLog-2003 | Loading commit data... | |
ChangeLog-2004 | Loading commit data... | |
ChangeLog-2005 | Loading commit data... | |
ChangeLog-2006 | Loading commit data... | |
ChangeLog-2007 | Loading commit data... | |
ChangeLog-2008 | Loading commit data... | |
ChangeLog-2009 | Loading commit data... | |
ChangeLog-2010 | Loading commit data... | |
ChangeLog-2011 | Loading commit data... | |
ChangeLog-2012 | Loading commit data... | |
ChangeLog-2013 | Loading commit data... | |
ChangeLog-2014 | Loading commit data... | |
ChangeLog-2015 | Loading commit data... | |
ChangeLog-2016 | Loading commit data... | |
ChangeLog-2017 | Loading commit data... | |
ChangeLog-2018 | Loading commit data... | |
ChangeLog-2019 | Loading commit data... | |
Makefile.am | Loading commit data... | |
Makefile.in | Loading commit data... | |
README | Loading commit data... | |
acinclude.m4 | Loading commit data... | |
aclocal.m4 | Loading commit data... | |
config.h.in | Loading commit data... | |
configure | Loading commit data... | |
configure.ac | Loading commit data... | |
configure.host | Loading commit data... | |
crossconfig.m4 | Loading commit data... | |
fragment.am | Loading commit data... | |
linkage.m4 | Loading commit data... |