This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/21879] Memory management problem in new C parser
- From: "joseph at codesourcery dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Jun 2005 14:17:04 -0000
- Subject: [Bug c/21879] Memory management problem in new C parser
- References: <20050602134308.21879.ebotcazou@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From joseph at codesourcery dot com 2005-06-02 14:17 -------
Subject: Re: New: Memory management problem in new C parser
On Thu, 2 Jun 2005, ebotcazou at gcc dot gnu dot org wrote:
> Parser obstack memory is wrongly freed in c_parser_translation_unit, but I don't
> know enough of the new C parser to debug it myself.
I don't see anything intrinsically to do with the parser in this bug; when
a function finishes, label_context_stack_se and label_context_stack_vm
should end up as NULL so this memory should not be live.
The problem looks to me to be that
if (decl1 == 0)
return 0;
in start_function also needs to do
label_context_stack_se = label_context_stack_se->next
label_context_stack_vm = label_context_stack_vm->next
before returning. This problem could also apply on 4.0 branch (even if
not with these testcases) so the fix should be applied there as well.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=21879