r265275 - in /branches/gcc-8-branch/libstdc++-v...
redi@gcc.gnu.org
redi@gcc.gnu.org
Thu Oct 18 17:40:00 GMT 2018
Author: redi
Date: Thu Oct 18 17:40:29 2018
New Revision: 265275
URL: https://gcc.gnu.org/viewcvs?rev=265275&root=gcc&view=rev
Log:
PR libstdc++/87641 correctly initialize accumulator in valarray::sum()
Use the value of the first element as the initial value of the
__valarray_sum accumulator. Value-initialization might not create the
additive identity for the value type.
PR libstdc++/87641
* include/bits/valarray_array.h (__valarray_sum): Use first element
to initialize accumulator instead of value-initializing it.
* testsuite/26_numerics/valarray/87641.cc: New test.
Added:
branches/gcc-8-branch/libstdc++-v3/testsuite/26_numerics/valarray/87641.cc
Modified:
branches/gcc-8-branch/libstdc++-v3/ChangeLog
branches/gcc-8-branch/libstdc++-v3/include/bits/valarray_array.h
More information about the Libstdc++-cvs
mailing list