------- 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

Reply via email to