OSDN Git Service

* testsuite/g++.old-deja/g++.eh/badalloc1.C: Tweak to
authorljrittle <ljrittle@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 16 Dec 2003 11:48:50 +0000 (11:48 +0000)
committerljrittle <ljrittle@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 16 Dec 2003 11:48:50 +0000 (11:48 +0000)
        pass with -pthread on FreeBSD systems.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@74689 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C

index c7cd477..d1cf3a4 100644 (file)
@@ -1,3 +1,8 @@
+2003-12-16  Loren James Rittle  <ljrittle@acm.org>
+
+       * testsuite/g++.old-deja/g++.eh/badalloc1.C: Tweak to
+       pass with -pthread on FreeBSD systems.
+
 2003-12-16  Richard Sandiford  <rsandifo@redhat.com>
 
        * config/mips/mips.c (mips_file_end): Only write symbols that have
index 34eb37b..907474e 100644 (file)
@@ -1,5 +1,5 @@
 // { dg-do run { xfail xstormy16-*-* *-*-darwin* } }
-// Copyright (C) 2000, 2002 Free Software Foundation, Inc.
+// Copyright (C) 2000, 2002, 2003 Free Software Foundation, Inc.
 // Contributed by Nathan Sidwell 6 June 2000 <nathan@codesourcery.com>
 
 // Check we can throw a bad_alloc exception when malloc dies.
@@ -14,8 +14,15 @@ 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"
+const int arena_size = 131072;
+#else
 const int arena_size = 32768;
 #endif
+#endif
 
 struct object
 {
@@ -98,6 +105,17 @@ 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
+
   fail = 1;
 
   try{fn_throw();}