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

cintyram <cintyram at yahoo.com> cintyram at yahoo.com
Wed Feb 19 13:53:04 PST 2003


hi alexander and ric,
  i had made the following change ..

 AST(const AST& other) : ref(other.ref ? other.ref->increment() : 0) {}
//ram /  AST(const AST& other) : ref(other.ref->increment()) {}

as the constructors of all the other classes look like the uncommented
code;

actually i did not notice any effects of the change ;

but since yesterday i have a funny problem

if i call ast->toStrinList() where ast is the tree returned by the
parser, the call is going ot BaseAST::toSTringTree() ;

if i call ast->toStringTree() i get an error message which says 
"the calue of ESP was not properly saved across a function call ... "

dont now how to fix it, everything was working fine till day before
yesterday and without making any changes to the code, suddenly this
condition appears :)

cheers
ram


--- In antlr-interest at yahoogroups.com, "Alexander Lenski"
<alenski at d...> wrote:
> 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.


 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 



More information about the antlr-interest mailing list