From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25473 invoked by alias); 27 Jan 2015 11:49:11 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 25401 invoked by uid 55); 27 Jan 2015 11:49:03 -0000 From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/64535] Emergency buffer for exception allocation too small Date: Tue, 27 Jan 2015 11:49:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenther at suse dot de X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: rguenth at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-01/txt/msg03058.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64535 --- Comment #18 from rguenther at suse dot de --- On Tue, 27 Jan 2015, redi at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64535 > > --- Comment #17 from Jonathan Wakely --- Ah, I > assumed the lack of destructor was intentional, so we can still deal > with exceptions while destroying globals. Otherwise an exception could > try to allocate from the pool after the destructor has run. Well - technically accessing emergency_pool after its default destructor ran is undefined (though we don't seem to run any destructor on it... I wonder if we do for __scoped_lock and if that works). I hope that initialization/destruction order imposed by some means allows EH to be thrown during initialization or destruction (though what would catch that?) We can make the patch safer by using pool::~pool () { __gnu_cxx::__scoped_lock sentry(emergency_mutex); free (arena); arena = NULL; } and/or by attaching a init_priority to the class. But again - where can you catch exceptions thrown from global initializers / destructors? If I throw from a __thread global constructor will the parent process be able to catch that exception somehow?