From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1A2BC3858C50; Tue, 27 Sep 2022 15:45:52 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1A2BC3858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664293552; bh=2/bQFgeyEdtTQaPp6QYJyEMyk1WAuL6eco6MRCcKSRc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=mV4+6JV7SrE3kx1IpOiWl9TfR9frGP+esyqv5/FHQYPwYOWxZro9ihvhC2HwT3eAN nR/hH7dQ8T9S2n2RZsT04Zf6ghxgc1h3tbitPatHBRGYfld7ClXu/1pFfIrjVLm44O 1luN9nZ437gD06Kq1P1vHvIJGUaBN399Ssn0rIzI= From: "dumoulin.thibaut at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/64535] Emergency buffer for exception allocation too small Date: Tue, 27 Sep 2022 15:45:43 +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: dumoulin.thibaut at gmail dot com X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED 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: cc Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D64535 Thibaut M. changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dumoulin.thibaut at gmail = dot com --- Comment #27 from Thibaut M. --- With this patch, a global variable is declared and `malloc` is called in its constructor. Linking libstdc++ will automatically allocate at least 2528 bytes on the he= ap. Since this library is also used in embedded software, this is a problem, 2,= 5ko represent a lot of memory (when you have only 4ko available for example). A temporary solution would be to call the freeres() function but better solut= ion would be to do not allocate at all. Second problem with this commit: the constructor of the global variable `po= ol emergency_pool` must be call at run time due to `malloc` and `new` function= s. Even if this code is not used, the linker script will put the constructor in `.init_array` section. Linker cannot get rid of this constructor due to non-pure functions called. A patch could be a least to avoid this `malloc` with some `#define` options? Or maybe you know a solution to avoid those problems?=