Re: How to restart FLEX scanners?

jenglish@flightlab.com (Joe English)
18 Feb 1999 10:47:19 -0500

          From comp.compilers

Related articles
How to restart FLEX scanners? jenglish@flightlab.com (1999-02-03)
Re: How to restart FLEX scanners? gneuner@dyn.com (1999-02-12)
Re: How to restart FLEX scanners? rkrayhawk@aol.com (1999-02-16)
Re: How to restart FLEX scanners? jenglish@flightlab.com (1999-02-18)
| List of all articles for this month |

From: jenglish@flightlab.com (Joe English)
Newsgroups: comp.compilers
Date: 18 Feb 1999 10:47:19 -0500
Organization: Advanced Rotorcraft Technology, Inc.
References: 99-02-013
Keywords: lex, comment

A couple of weeks ago, I wrote:


>I have an interactive parser built with lex/yacc that I'm trying to
>port to flex. It's giving me considerable problems.
> [...]
>Everything seems to work fine so far [...] But if main() calls
>parse_file() a second time, the program invariably gets a segmentation
>fault somewhere in the bowels of malloc() or free().
>This indicates that somebody is scribbling over memory that they
>shouldn't be.


Then rather self-assuredly stated:


> I suspect that yylex() is the culprit, since this code has been in
> production for several years (using stock lex on several different
> Unices) with no problems.


A colleague just introduced me to Electric Fence, which turned up the
actual source of the problem in about 30 seconds. It had nothing to
do with FLEX, it was a long-standing bug elsewhere in the code
(fclose()ing the same FILE * twice) that somehow managed to escape
detection up 'til now. After fixing that, the problem went away.


My apologies for bothering you :-)




--Joe English


    jenglish@flightlab.com
[About three times a week I get messages from people who are sure they've
found a lex or yacc bug because their program crashes. It's always a
pointer bug somewhere. -John]


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.