bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug report / Bison 1.875] %destructor directive causing segfault du


From: Jeannot_Langlois
Subject: Re: [Bug report / Bison 1.875] %destructor directive causing segfault during compilation
Date: Sun, 08 Feb 2004 19:23:44 -0500
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.0.2) Gecko/20030208 Netscape/7.02

Hans Aberg wrote:
At 22:13 -0500 2004/02/07, Jeannot_Langlois wrote:
%union  /* data types */
{
   char chr;        /* character */
   char* str;       /* string */
   int val;         /* integer (??NOT USED -- DELETE ME??) */
}
    
/* DESTRUCTORS */
%destructor { free ($$); } R_MESSAGE
%destructor { free ($$); } O_PREFIX
%destructor { free ($$); } R_PREFIX
    
I notied that the problems just needs the presence of a single
%destructor line to trigger a segfault.  As soon as I comment all my
%destructor lines, the problem vanishes and the C code is produced
normally without segfaults... but then, if executed, the parser will
have memory leaks... that's not ok :(.
    

My suspicion is that the experimental %destructor feature does not look at
the types in order to decide when to apply it. Thus, you might get attempts
to free the other %union fields, that would cause the segmentation fault.

Something for C-programmers to fix. -- I use C++, which comes with builtin
memory releases.

  Hans Aberg

  
Hi there,


Maybe I am wrong, but, I get this segfault when generating the parser's C code (NOT during the parser's compilation -- sorry for the misleading thread subject).  If this would be a type-checking problem, wouldn't it rather happen during the parser's execution AFTER the C code has been compiled and I ran the binary executable?

Please correct me if I am wrong or if I missed something.

So far I recompiled Bison 1.875 from sources I traced a few references to %destructor in "parse-gram.y" and "symtab.c", but I am still looking for the exact cause (the segfault happens AFTER these references are made).

Thanks a lot for your help.

Regards,


--
Jeannot Langlois - Signature Jeannot Langlois
B. Sc.  Computer Science / B. Sc.  Informatique
Software Developer / Programmeur-Analyste
System/Network Administrator / Administrateur Système/Réseau

LINUX_LOGO





reply via email to

[Prev in Thread] Current Thread [Next in Thread]