[antlr-interest] Bug in Generated Parser?

Jim Idle jimi at temporal-wave.com
Thu Jul 17 14:27:46 PDT 2008


On Fri, 2008-07-18 at 09:05 +1200, Gavin Lambert wrote:

> At 00:51 18/07/2008, Johannes Luber wrote:
> n't heard of it yet, but it's a Java target problem, too,
>  >so Ter has to say, if removing the static modifier for the
>  >BitSet variables in the parser is enough and doesn't affect
>  >anything else.
> 
> I don't think that's sufficient -- after all, a single instance 
> might be re-used, or the rule-path followed might query that 
> structure again (expecting it to be in its unmodified state).
> 
> Read-only variables should never be modified.  Any code that is 
> doing so is clearly erroneous.  (Perhaps it should be modifying a 
> clone of the object instead of the original?)


That's what the C runtime does, certainly, however this has now changed
to construct a bitset from the statically allocated bit list in the
parser. If yo udon't then you get a memory access error and the bug is
obvious. Perhaps this is a downside to not managing your own memory ;-)

Jim

> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080717/30f70f68/attachment.html 


More information about the antlr-interest mailing list