JIT Hiccup in DotNet 8.0 - eviltoast

Hi everyone,

i have a strange behaviour of the JIT in DotNet 8.0.

I have created a small demo project (on GitHub)

The crashing code is not verry complex. It is contained in a Cpp-Library compiled to DotNet-IL (managed C++). It is just doing some basic double math with a pow().

I can work arraund this problem by slightly changing the code but that is not satisfying. I whant to understand what i am doing wrong in c++ or if there is a bug in the JIT compiler or C++ compiler.

The code is working in a debug build and even the first 1000+ calls in a release build are working fine. At the point the Jit compiles the method again in stage 2 with full optimization the code starts crashing.

The crashing code is wrapped in a Try-Catch in the CS-Console project.

When setting a break point in the release build (after the first exception) to inspect the situation everything runs perfectly. Even after removint the break point and continue the execution the code runs fine.

Would be really nice if some one can help me with this.

Thanks in advanced!