3 // Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
4 // Free Software Foundation
6 // This file is part of the GNU ISO C++ Library. This library is free
7 // software; you can redistribute it and/or modify it under the
8 // terms of the GNU General Public License as published by the
9 // Free Software Foundation; either version 2, or (at your option)
12 // This library is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License along
18 // with this library; see the file COPYING. If not, write to the Free
19 // Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
22 // 27.4.2.5 ios_base storage functions
24 // XXX This test will not work for some versions of irix6 because of
25 // XXX bug(s) in libc malloc for very large allocations. However
26 // XXX -lmalloc seems to work.
27 // See http://gcc.gnu.org/ml/gcc/2002-05/msg01012.html
28 // { dg-options "-lmalloc" { target mips*-*-irix6* } }
30 // This fails on some versions of Darwin 8 because malloc doesn't return
31 // NULL even if an allocation fails (filed as Radar 3884894).
32 // { dg-do run { xfail *-*-darwin8.[0-4].* } }
34 // Skip test at -m64 on Darwin because RLIMITS are not being honored.
35 // Radar 6467883: 10.4/10.5 setrlimits are not honored by memory allocators
36 // Radar 6467884: 10.X systems are not robust when paging space is exceeded
37 // { dg-skip-if "" { *-*-darwin* && lp64 } { "*" } { "" } }
42 #include <testsuite_hooks.h>
47 bool test
__attribute__((unused
)) = true;
48 int max
= std::numeric_limits
<int>::max() - 1;
49 std::stringbuf strbuf
;
50 std::ios
ios(&strbuf
);
52 ios
.exceptions(std::ios::badbit
);
59 VERIFY( ios
.pword(1) == v
);
65 catch(std::ios_base::failure
& obj
)
77 VERIFY( ios
.pword(1) == v
);
79 // max is different code path from max-1
83 v
= ios
.pword(std::numeric_limits
<int>::max());
85 catch(std::ios_base::failure
& obj
)
99 VERIFY( ios
.iword(1) == 1 );
105 catch(std::ios_base::failure
& obj
)
117 VERIFY( ios
.iword(1) == 1 );
119 // max is different code path from max-1
123 l
= ios
.iword(std::numeric_limits
<int>::max());
125 catch(std::ios_base::failure
& obj
)
141 __gnu_test::set_memory_limits();