aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorMark Mitchell <mark@codesourcery.com>2004-11-26 22:02:34 +0000
committerJoseph Myers <jsm28@gcc.gnu.org>2004-11-26 22:02:34 +0000
commit3de878170d252a27d34c0e161ea2f0db2a553158 (patch)
treed43ad876e963b53ede7dfd7ba2ad6263acd465f1 /gcc
parent9fcc7481f804e1add6887c3c870f53343999da53 (diff)
downloadgcc-3de878170d252a27d34c0e161ea2f0db2a553158.zip
gcc-3de878170d252a27d34c0e161ea2f0db2a553158.tar.gz
gcc-3de878170d252a27d34c0e161ea2f0db2a553158.tar.bz2
badalloc1.C: Robustify.
2004-11-26 Mark Mitchell <mark@codesourcery.com> * g++.old-deja/g++.eh/badalloc1.C: Robustify. From-SVN: r91352
Diffstat (limited to 'gcc')
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C26
2 files changed, 16 insertions, 14 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index f2c9911..9973d15 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2004-11-26 Mark Mitchell <mark@codesourcery.com>
+
+ * g++.old-deja/g++.eh/badalloc1.C: Robustify.
+
2004-11-26 Richard Sandiford <rsandifo@redhat.com>
* gcc.dg/sibcall-[34].c: Remove MIPS xfails.
diff --git a/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C b/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C
index 907474e..8af1a07 100644
--- a/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C
+++ b/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C
@@ -14,10 +14,9 @@ extern "C" void *memcpy(void *, const void *, size_t);
#ifdef STACK_SIZE
const int arena_size = 256;
#else
-#ifdef __FreeBSD__
-// FreeBSD with threads requires even more space at initialization time.
-#include "bits/c++config.h"
-#include "bits/gthr.h"
+#if defined(__FreeBSD__) || defined(__sun__)
+// FreeBSD with threads and Solaris with threads require even more
+// space at initialization time.
const int arena_size = 131072;
#else
const int arena_size = 32768;
@@ -105,16 +104,15 @@ void fn_catchthrow() throw(int)
int main()
{
-#ifdef __FreeBSD__
-// FreeBSD with threads fails the test unless each thread primes itself.
- if (__gthread_active_p())
- {
- try{fn_throw();}
- catch(int a){}
- }
-// This was added to test with well-known idiom to detect regressions here
-// rather than always failing with -pthread.
-#endif
+ /* On some systems (including FreeBSD and Solaris 2.10),
+ __cxa_get_globals will try to call "malloc" when threads are in
+ use. Therefore, we throw one exception up front so that
+ __cxa_get_globals is all set up. Ideally, this would not be
+ necessary, but it is a well-known idiom, and using this technique
+ means that we can still validate the fact that exceptions can be
+ thrown when malloc fails. */
+ try{fn_throw();}
+ catch(int a){}
fail = 1;