GCC implicitly adds an .exe suffix if it is given an output file name, but the file name doesn't contain a suffix, and there are certain users of GCC that rely on this behaviour (and run into issues when trying to use Clang instead of GCC). And MSVC's cl.exe also does the same (but not link.exe).
However, GCC only does this when actually running on windows, not when operating as a cross compiler.
This was reported to me at https://github.com/mstorsjo/llvm-mingw/issues/60.
As GCC doesn't have this behaviour when cross compiling, we definitely shouldn't introduce the behaviour in such cases (as it would break at least as many cases as this fixes).
Is it worth adding such inconsistent behaviour (with two separate tests, one for running on windows and one elsewhere)?
Can you add what you wrote in the commit message as a comment here to explain the divergence in behavior based on the compiler's host OS? I can imagine that a future maintainer will try to make the code behave the same way regardless of host.