www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - DDoc macro seg fault

reply clayasaurus <clayasaurus gmail.com> writes:
/***

    Macros:
       RED = seg fault

*/
void open()
{
}

dmd -D -c crash.d

generating code for function 'open'
Segmentation fault
Oct 14 2005
parent "Unknown W. Brackets" <unknown simplemachines.org> writes:
It looks like in Declaration::emitComment(), this line:

DocComment *dc = DocComment::parse(sc, this, comment);

Is correctly creating a new DocComment.  Unfortunately, this shiny new 
DocComment never gets its pmacrotable set to anything, so later, when 
DocComment::parseMacros() gets called because of MacroSection::write(), 
this line:

Macro::define(pmacrotable, namestart, namelen, textstart, textlen);

Incorrectly calls Macro::define without any pmacrotable.

I would think that DocComment::parse() should just link to the Module's 
macrotable, e.g.:

dc->pmacrotable = &sc->module->macrotable;

But, of course, that has the effect of making macro changes (using 
Macros) not apply only to the comment in question and lower in scope... 
whether or not that's how it should work or not.

-[Unknown]
Oct 14 2005