[antlr-interest] ATTN: Ric Klaren. Bug in tne AST copy ctor
Alexander Lenski
alenski at dca.net
Wed Feb 19 10:14:48 PST 2003
Hi,
Sorry for persistence, I did not get any feedback. What should the clone functions of the AST... classes create? Is it about deep copies or what? In other words, am I correct with the original msg or not?
Thanks a lot,
Alex
----- Original Message -----
From: Alexander Lenski
To: antlr-interest at yahoogroups.com
Sent: Friday, February 14, 2003 12:34 AM
Subject: [antlr-interest] ATTN: Ric Klaren. Bug in tne AST copy ctor
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
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20030219/a647bd6b/attachment.html
More information about the antlr-interest
mailing list