[Top][All Lists]

[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: Sat, 12 Dec 2020 07:41:26 +0100

Hi Jot,

> Le 11 déc. 2020 à 11:41, Jot Dot <jotdot@shaw.ca> a écrit :
> Hello Akim,
> That was the issue. Just say that :)

I apologize for my tone, it was very harsh, and I did not intended
it to be.  I was definitely angry, but mostly at me, for the time
it took me to understand what was going on.  What the debugger told
me made no sense, and instead of pausing and thinking about what
could be going on, I kept on stepping, as a bee expecting the window
to magically vanish at some point.  But I eventually noticed
that it was trying to reach a member variable that was located
outside of the object, then something clicked in my head: the Parser
class has two sizes.  Then it was easy.

>> No wonder that %define parse.trace "fixes" your problem, since it
>> defines *properly* YYDEBUG.
>> Bottom line: stop messing with macros.
> Then change your manual to reflect this.
> https://www.gnu.org/software/bison/manual/html_node/Enabling-Traces.html
> YYDEBUG is still supported as a POSIX yacc compliant method (for c++ too)
> %define parse.trace is a Bison extension, thus not POSIX yacc compliant.

POSIX has nothing to say about C++, or Java, or D, or GLR, etc.  All
these are Bison extensions, and POSIX is irrelevant.

> quote just under the YYDEBUG part of that web page:
> "We suggest that you always enable the trace option so that debugging is 
> always possible."
> My take on that web page was that YYDEBUG is the minimum that should be 
> enabled
> and that the Bison "extension" 'parse.trace' gives more info than the 
> "standard" YYDEBUG.
> I can see now that I was wrong.

And I can see that my wording could use some improvement in this area.
Will do.  Sorry about that.

> An "extension" extends. It usually does not mean "alternate way of doing 
> exactly the same".

Yes, I was referring to the syntax, not the semantics.

> From what I am hearing, 'parse.trace' is just that.

Except that it is safe, and works also in Java or D, where there are no

> Borrowing your phrase: "(does ODR ring a bell?)"


> A "Suggested Improvement":
> My suggestion is to edit that web page:
> 1) Mention the parse.trace is simply a far less error prone alternative to 
> the YYDEBUG macro.
> 2) If POSIX compliance is preferred and YYDEBUG is used, the proper placement 
> of the YYDEBUG macro

I agree that it must be spelled out (with the exception that POSIX is for
--yacc only).

> is in the %code requires section, not %code top (for us newbies)
> 3) change the line:
> "We suggest that you always enable the trace option so that debugging is 
> always possible."
> to:
> "We suggest that you always enable one of the above options so that debugging 
> is always possible."



reply via email to

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