In 10.2.3, there is an issue affecting methods using the fastcall calling convention that allocate 4KB or more on the stack inside the method. The stack allocation could result in the ‘this’ pointer containing an incorrect value. This was reported as:
- RSP-20171
- RSP-20297 and RSP-20173 (duplicate reports)
You can download the hotfix from CodeCentral.
Technical info
For those interested in the technical details, when the stack grows, it might need to grow into a new page, and 4KB is the size of a page on Windows and so by definition will cause this to occur. When the compiler sees a 4KB or larger stack allocation it calls a method to ensure the next page(s) are committed.
We have always had one RTL method to handle this, _chkstk, and in 10.2.3, we introduced a new version, _chkstk_noalloc. This new method ensures that the esp register is left unchanged; if not, while your app would be fine, the debugger could get confused and think it was in a recursive method. We fixed this issue in 10.2.3. This hotfix addresses a related issue where the eax register was not being restored correctly, which for a fastcall method manifests as the ‘this’ pointer.
Make sure you rebuild and relink your projects against the 10.2.3 RTL, since if you mix old and new RTLs you will get an unresolved external against this new method. Upgrading to 10.2.3 and this hotfix solves some debugging scenarios that were problematic in earlier releases, and enables debugging of method parameters and other items in a method with a very large allocation.
Design. Code. Compile. Deploy.
Start Free Trial Upgrade Today
Free Delphi Community Edition Free C++Builder Community Edition