[antlr-interest] Error in generated C code (struct referenced without being initialized)
Andy Grove
andy.grove at codefutures.com
Mon Feb 2 19:49:23 PST 2009
Hi,
In my generated parse, a variable "a1" is declared thus:
DbsMySQL_CPPParser_alias1_return a1;
Under certain conditions the variable gets initialized by calling a method:
a1=alias(ctx);
However, when parsing my input, the variable is not getting initialized but
it *is* getting referenced in the following expression, causing a seg fault:
(a1.start != NULL ? STRSTREAM->toStringTT(STRSTREAM, a1.start, a1.stop) :
NULL )
Because a1 is never initialized, a1.start refers to non null value. If I add
a1.start = NULL after a1 is declared then the seg fault is fixed.
Is this a known issue? Do I need to specify special options when generating
the code to make sure structs get initialized?
Thanks,
Andy.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090202/3762b46f/attachment.html
More information about the antlr-interest
mailing list