From 8eaeb50dbea24c1c8aca400d7ea4c319f2a5be2f Mon Sep 17 00:00:00 2001 From: "Kaveh R. Ghazi" Date: Tue, 21 Feb 2006 13:34:23 +0000 Subject: [PATCH] re PR c++/21583 (FAIL: g++.old-deja/g++.eh/badalloc1.C execution test) PR c++/21583 Backport: 2004-11-30 Loren James Rittle * g++.old-deja/g++.eh/badalloc1.C (arena_size): Bump up to 262144 to support new requirements on FreeBSD 5. 2004-11-26 Mark Mitchell * g++.old-deja/g++.eh/badalloc1.C: Robustify. From-SVN: r111333 --- gcc/testsuite/ChangeLog | 14 ++++++++++ gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C | 28 +++++++++---------- 2 files changed, 27 insertions(+), 15 deletions(-) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index ce81d3ee2696..831343b928d4 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,17 @@ +2006-02-21 Kaveh R. Ghazi + + PR c++/21583 + + Backport: + 2004-11-30 Loren James Rittle + + * g++.old-deja/g++.eh/badalloc1.C (arena_size): Bump up to 262144 + to support new requirements on FreeBSD 5. + + 2004-11-26 Mark Mitchell + + * g++.old-deja/g++.eh/badalloc1.C: Robustify. + 2006-02-08 Volker Reichelt PR c++/26070 diff --git a/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C b/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C index 907474e13fac..b4a245045852 100644 --- a/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C +++ b/gcc/testsuite/g++.old-deja/g++.eh/badalloc1.C @@ -14,11 +14,10 @@ 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; +#if defined(__FreeBSD__) || defined(__sun__) +// FreeBSD with threads and Solaris with threads require even more +// space at initialization time. FreeBSD 5 now requires over 131072 bytes. +const int arena_size = 262144; #else const int arena_size = 32768; #endif @@ -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; -- 2.47.2