[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug report / Bison 1.875] %destructor directive causing segfault d
From: |
Hans Aberg |
Subject: |
Re: [Bug report / Bison 1.875] %destructor directive causing segfault during compilation |
Date: |
Sun, 8 Feb 2004 14:52:28 +0100 |
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