With a plain g++ foo.cc -o foo, I get a foo.exe that prints "OK".
However, with g++ -gdwarf-5 -Og foo.cc -o foo, I get a binary that reports
-bash: ./foo.exe: cannot execute binary file: Exec format error
GDB can load the binary and show symbols just fine, but trying to run results in:
Error creating process /cygdrive/.../foo.exe, (error 193).