Re: Heap Corruption using MSVC (found the issue)
Akim Demaille <[email protected]>
| Newsgroups | gmane.comp.parsers.bison.bugs |
|---|---|
| Message-ID | <[email protected]> |
Jot, > Le 11 déc. 2020 à 01:35, Jot Dot <[email protected]> a écrit : > > re: Posting in help-bison, same topic > > I have isolated the problem with my code. > If (in my .y file) I do not have this defined: > > %define parse.trace > > then I get a heap corruption error. > By simply adding that line, the corruption disappears. I spent an awful lot of time tracking your issue, which is: %code top { #define YYDEBUG 1 [...] } This is dead wrong. You are *compiling* the parser with YYDEBUG set, but to the rest of the application you expose a Parser class *without* YYDEBUG. So you have to different sizes for the same class in a one program, of course that does not work (does ODR ring a bell?). No wonder that %define parse.trace "fixes" your problem, since it defines *properly* YYDEBUG. Bottom line: stop messing with macros.