gcc strange optimization for nullptr check when accessing a member function
I have a code to test the nullptr check as follow and this is my godblot:
-O3 optimisation in C++ causing disk write function to fail
I have code which outputs .txt files using ofstream in C++ via a helper function. It works fine when no optimisation is set in GCC but when I choose any level of -O1, -O2, or -O3 the debugger in VSCode flags a call stack error (shown in attached image) and fails to write to the specified file.