For this question, I have done my best to eliminate every external factor I could think of: the below description is what I get on Windows, Visual Studio with the same version of libraries in both sides.
With the aim to be able to execute it on multiple platforms, I have recently converted a VS solution (.sln file) to a CMake project.
At first glance everything is fine: the project compiles and starts as it should.
However, I soon noticed the CMake build (and only it) crashed when parsing a string with code generated from Antlr.
When debugging, I see the same calls being made, which is to be expected, but there is a glaring issue with what the debugger shows in the CMake project.
Example, I have traced my code when it lands inside the following method.
void Lexer::InitializeInstanceFields() {
_syntaxErrors = 0;
token = nullptr;
_factory = CommonTokenFactory::DEFAULT.get();
tokenStartCharIndex = INVALID_INDEX;
tokenStartLine = 0;
tokenStartCharPositionInLine = 0;
hitEOF = false;
channel = 0;
type = 0;
mode = Lexer::DEFAULT_MODE;
}
At the start, the debugger shows the same data/state for this, in both projects:

But everything falls apart here.
Executing the method step by step with my debugger:
- shows the attributes being changed as they should by the code, in the
.slnproject. - shows no change whatsoever on
thiswhen I execute, in the CMake project.
I am unsure what to do with it but I can add the following piece of information.
Here is my debugger stopped at the start of the function. this is 0x00[...]feb40.

1 step later, same call: this is now 0x00[...]feac0.

That change is not something I observe in the `.sln` project.
I am flabbergasted by this issue and have no idea by which point I should start troubleshooting it.Though I think that is not something I should do, I have tried rebuilding from scratch several times, with the same result.
Would you have an idea?