r265291 - in /branches/gcc-6-branch/libstdc++-v...

redi@gcc.gnu.org redi@gcc.gnu.org
Thu Oct 18 21:41:00 GMT 2018


Author: redi
Date: Thu Oct 18 21:41:01 2018
New Revision: 265291

URL: https://gcc.gnu.org/viewcvs?rev=265291&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-6-branch/libstdc++-v3/testsuite/26_numerics/valarray/87641.cc
Modified:
    branches/gcc-6-branch/libstdc++-v3/ChangeLog
    branches/gcc-6-branch/libstdc++-v3/include/bits/valarray_array.h



More information about the Libstdc++-cvs mailing list