gcc/libstdc++-v3/testsuite
Jonathan Wakely fab2c75b73 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.

Make a similar change to __valarray_product even though it's only ever
used internally with a value_type of size_t.

	PR libstdc++/87641
	* include/bits/valarray_array.h (__valarray_sum): Use first element
	to initialize accumulator instead of value-initializing it.
	(__valarray_product<_Tp>): Move to ...
	* src/c++98/valarray.cc (__valarray_product<_Tp>): Here. Use first
	element to initialize accumulator.
	(__valarray_product(const valarray<size_t>&)): Remove const_cast made
	unnecessary by LWG 389.
	* testsuite/26_numerics/valarray/87641.cc: New test.

From-SVN: r265270
2018-10-18 16:38:50 +01:00
..
17_intro Add <bit> and <version> to freestanding headers 2018-08-13 19:54:34 +01:00
18_support * testsuite/18_support/new_nothrow.cc: XFAIL on AIX. 2018-08-21 10:03:16 -04:00
19_diagnostics Add workaround for non-unique errno values on AIX 2018-08-03 13:53:34 +01:00
20_util re PR libstdc++/87619 (sizeof(std::variant) can be reduced if its variant_size is UCHAR_MAX) 2018-10-17 22:08:51 +03:00
21_strings 10.cc: Add dg-require-fileio. 2018-08-31 15:09:47 -04:00
22_locale Adjust test to pass with latest glibc 2018-10-15 14:55:42 +01:00
23_containers Fix tests that fail when compiled without optimisation 2018-10-16 13:06:05 +01:00
24_iterators PR libstdc++/86734 make reverse_iterator::operator-> more robust 2018-07-30 18:13:05 +01:00
25_algorithms 10.cc: Add dg-require-fileio. 2018-08-31 15:09:47 -04:00
26_numerics PR libstdc++/87641 correctly initialize accumulator in valarray::sum() 2018-10-18 16:38:50 +01:00
27_io PR libstdc++/87618 fix typos in linker script 2018-10-16 12:14:37 +01:00
28_regex PR libstdc++/87061 remove pmr type aliases for COW strings 2018-08-22 23:54:33 +01:00
29_atomics Add missing dg-require-cstdint directives to tests 2018-07-26 15:03:28 +01:00
30_threads PR libstdc++/80538 Only call sleep for non-zero values 2018-10-11 17:37:23 +01:00
abi Update copyright years. 2018-01-03 11:03:58 +01:00
backward Remove duplicate function call in test 2018-05-02 17:27:01 +01:00
config Update copyright years. 2018-01-03 11:03:58 +01:00
data
decimal Update copyright years. 2018-01-03 11:03:58 +01:00
experimental Rename namespace alias in test to avoid name collision 2018-10-16 17:13:00 +01:00
ext Make ext allocators support heterogeneous equality comparison 2018-10-11 12:32:29 +01:00
lib Introduce dg-add-options net_ts 2018-10-16 12:27:52 +00:00
libstdc++-abi Update copyright years. 2018-01-03 11:03:58 +01:00
libstdc++-dg Update copyright years. 2018-01-03 11:03:58 +01:00
libstdc++-prettyprinters printers.py (NodeIteratorPrinter): New. 2018-03-08 06:26:15 +00:00
libstdc++-xmethods Update copyright years. 2018-01-03 11:03:58 +01:00
performance Update copyright years. 2018-01-03 11:03:58 +01:00
special_functions PR libstdc++/83140 - assoc_legendre returns negated value when m is odd 2018-05-10 13:59:52 +00:00
tr1 Add missing dg-require-cstdint directives to tests 2018-07-26 15:03:28 +01:00
tr2 Update copyright years. 2018-01-03 11:03:58 +01:00
util 2018-09-02 François Dumont <fdumont@gcc.gnu.org> 2018-09-02 10:20:57 +00:00
Makefile.am Update copyright years. 2018-01-03 11:03:58 +01:00
Makefile.in PR libstdc++/86450 use -Wabi=2 and simplify -Werror use 2018-07-17 14:18:47 +01:00