[antlr-interest] ATTN: Ric Klaren. Bug in tne AST copy ctor

Alexander Lenski alenski at dca.net
Thu Feb 13 21:34:04 PST 2003


Hi,
The AST's copy ctor is defined in the 2.7.2 as

    AST(const AST& other) : ref(other.ref->increment()) {}

The ref(other.ref->increment()) sets ref of the copy with the ref's pointer from the other. As a consequence, all clone funcs of the AST... classes and subsequently the dup... funcs of the ASTFactory produce memory leaks, perform corrupted operations instead of expected functionality.

In the 2.7.1 we had

    AST(const AST& other) : ref( 0 ) {}

This fixes the problem and works just fine. If I did not miss something, couldn't you fix that please.
BTW, the antlr.dll (VC7.0) works just fine. I have built my lexers-parsers in the dll form too, no problems at all with running the clients.

Thanks,
Alex
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20030214/55527931/attachment.html


More information about the antlr-interest mailing list