Relative Content

Tag Archive for cgccoptimization

-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.