bug-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Heap Corruption using MSVC (found the issue)


From: Akim Demaille
Subject: Re: Heap Corruption using MSVC (found the issue)
Date: Fri, 11 Dec 2020 06:46:15 +0100

Jot,

> Le 11 déc. 2020 à 01:35, Jot Dot <jotdot@shaw.ca> 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.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]