From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 99CE4385701C; Tue, 4 Oct 2022 00:22:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 99CE4385701C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1664842967; bh=a31FFX9sHulcTvdC4hVP85Ziqq+H/FUYQwWdiybLiZw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ocS4cWofPSPsApM5KRJm73nc2A20vrua1xrtdQlY4Dk0GVPDdZrBqU+4IQC7qSDvf KyrP06gk4wIvNlRLjoNJLA+Nmbmj2sFsctvOqqQh8jgB90KfQoaeQhPv/WJxfUyFO5 3vj3TQlUaG8bOdI8XtTSSw8hhhQWsn9TsB8mW+8I= From: "ian at airs dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libgcc/106949] Memory leak using VLA with -fsplit-stack Date: Tue, 04 Oct 2022 00:22:47 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libgcc X-Bugzilla-Version: 13.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ian at airs dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned 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: 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=3D106949 --- Comment #3 from Ian Lance Taylor --- I don't think your attached patch is going to work. The code assumes that = it is running within a stack segment. You can't just add a stack segment with= out changing the stack pointer. But something like your suggestion might work. If the function is going to call __morestack_allocate_stack_space, then at the start of the function ca= ll a new function __morestack_allocating_stack_space. That function can return a pointer. The __morestack_allocate_stack_space function can add its allocat= ions to a list at that pointer. At the end of the function call another new function that releases the allocated space. Some work will be required to = make sure that the space gets released if an exception is thrown.=