Fix a regression introduced by the fix of libstdc++/68276.

2015-12-18  Ville Voutilainen  <ville.voutilainen@gmail.com>

	Fix a regression introduced by the fix of libstdc++/68276.
	* src/c++11/ios.cc (_M_grow_words): Catch bad_alloc again so that
	bad_array_new_length is handled properly.

From-SVN: r231839
This commit is contained in:
Ville Voutilainen 2015-12-18 23:27:53 +02:00 committed by Ville Voutilainen
parent e8f47b663f
commit ca2c1b3283
2 changed files with 13 additions and 1 deletions

View File

@ -1,3 +1,9 @@
2015-12-18 Ville Voutilainen <ville.voutilainen@gmail.com>
Fix a regression introduced by the fix of libstdc++/68276.
* src/c++11/ios.cc (_M_grow_words): Catch bad_alloc again so that
bad_array_new_length is handled properly.
2015-12-18 Ville Voutilainen <ville.voutilainen@gmail.com>
PR libstdc++/68276

View File

@ -121,7 +121,13 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
if (__ix < numeric_limits<int>::max())
{
__newsize = __ix + 1;
__words = new (std::nothrow) _Words[__newsize];
/* We still need to catch bad_alloc even though we use
a nothrow new, because the new-expression can throw
a bad_array_new_length. */
__try
{ __words = new (std::nothrow) _Words[__newsize]; }
__catch(const std::bad_alloc&)
{ __words = nullptr; }
if (!__words)
{
_M_streambuf_state |= badbit;